mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2026-11-17 16:13:36 +08:00
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.
35 lines
852 B
TypeScript
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
|