enhance: embed routerを分離(route定義をboot時に変更できるようにする改修を含む)
This commit is contained in:
@@ -15,6 +15,7 @@ import { updateI18n } from '@/i18n.js';
|
||||
import { $i, refreshAccount, login } from '@/account.js';
|
||||
import { defaultStore, ColdDeviceStorage } from '@/store.js';
|
||||
import { fetchInstance, instance } from '@/instance.js';
|
||||
import type { IRouter } from '@/nirax.js';
|
||||
import { deviceKind } from '@/scripts/device-kind.js';
|
||||
import { reloadChannel } from '@/scripts/unison-reload.js';
|
||||
import { getUrlWithoutLoginId } from '@/scripts/login-id.js';
|
||||
@@ -22,14 +23,17 @@ import { getAccountFromId } from '@/scripts/get-account-from-id.js';
|
||||
import { deckStore } from '@/ui/deck/deck-store.js';
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
import { fetchCustomEmojis } from '@/custom-emojis.js';
|
||||
import { setupRouter } from '@/router/definition.js';
|
||||
import { createMainRouter } from '@/router/definition.js';
|
||||
import { setupRouter } from '@/router/main.js';
|
||||
|
||||
export type CommonBootOptions = {
|
||||
forceColorMode: 'dark' | 'light' | 'auto';
|
||||
routerFactory: ((path: string) => IRouter);
|
||||
};
|
||||
|
||||
const defaultCommonBootOptions: CommonBootOptions = {
|
||||
forceColorMode: 'auto',
|
||||
routerFactory: createMainRouter,
|
||||
};
|
||||
|
||||
export async function common(createVue: () => App<Element>, partialOptions?: Partial<CommonBootOptions>) {
|
||||
@@ -253,7 +257,7 @@ export async function common(createVue: () => App<Element>, partialOptions?: Par
|
||||
|
||||
const app = createVue();
|
||||
|
||||
setupRouter(app);
|
||||
setupRouter(app, bootOptions.routerFactory);
|
||||
|
||||
if (_DEV_) {
|
||||
app.config.performance = true;
|
||||
|
Reference in New Issue
Block a user