ray-template/__test__/utils/setupMiniApp.ts
XiaoDaiGua-Ray 0e688a34bf
feat(fullstack): complete account and session integration
Enforce live session grants for runtime routes and support profile and
credential updates in both the backend and demo modes.

Add the account settings workspace and document fullstack setup and PC
acceptance.
2026-11-06 21:39:36 +08:00

35 lines
852 B
TypeScript

import { setupI18n } from '../../apps/admin/src/locales'
import { setupRouter } from '../../apps/admin/src/router'
import { setupStore } from '../../apps/admin/src/store'
import { piniaSigningStore } from '../../apps/admin/src/store/modules/signing'
import renderHook from '../utils/renderHook'
/**
*
* @description
* 初始化 mini ray template 应用环境。
* 该方法会初始化 store、router、i18n 等环境。
*
* @example
* const { app } = await setupMiniApp()
*/
const setupMiniApp = async (authenticated = false) => {
const [_, app] = renderHook(() => {})
setupStore(app)
await setupI18n(app)
if (authenticated)
await app.runWithContext(() =>
piniaSigningStore().signing({ name: 'admin', pwd: '123456' }),
)
await setupRouter(app, authenticated)
return {
app,
}
}
export default setupMiniApp