1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/stores/init-user-store.injectable.ts
Sebastian Malton 8a90c230be Move userStoreFileMigration call to the init runnable
Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-09-19 16:35:24 -04:00

29 lines
1.2 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import userStoreFileNameMigrationInjectable from "../../common/user-store/file-name-migration.injectable";
import userStoreInjectable from "../../common/user-store/user-store.injectable";
import { beforeApplicationIsLoadingInjectionToken } from "../start-main-application/runnable-tokens/before-application-is-loading-injection-token";
import initDefaultUpdateChannelInjectableInjectable from "../vars/default-update-channel/init.injectable";
const initUserStoreInjectable = getInjectable({
id: "init-user-store",
instantiate: (di) => {
const userStore = di.inject(userStoreInjectable);
const userStoreFileNameMigration = di.inject(userStoreFileNameMigrationInjectable);
return {
run: async () => {
await userStoreFileNameMigration();
userStore.load();
},
runAfter: di.inject(initDefaultUpdateChannelInjectableInjectable),
};
},
injectionToken: beforeApplicationIsLoadingInjectionToken,
});
export default initUserStoreInjectable;