UNPKG

magner

Version:

Universal admin panel magnetic to any backend

36 lines (35 loc) 1.12 kB
import { InjectionKey } from 'vue'; import { Store } from 'vuex'; import type { ModalConfig } from '../../types/utils/modals'; import { GlobalValues } from '../../global'; interface ModalData { handleSuccess: (data: unknown) => void; handleFail: (data: unknown) => void; config: ModalConfig<any>; } interface State { project: GlobalValues; language: string; user: unknown | null; role: string | null; /** * used only for mobile screens. If true - sidebar opened */ mobileSidebarOpened: boolean; sidebarCollapsed: boolean; modalData: ModalData | null; } /** * A key that is needed to access the store in a form of useStore() hook in the * setup() function of every component. */ export type InjectionKeyType = InjectionKey<Store<State>>; export declare const injectionKey: InjectionKeyType; /** * Global store with the state that is commonly used throughout many * components in the project. */ export declare const store: () => Store<State>; export type StoreType = ReturnType<typeof store>; declare const useStore: () => Store<State>; export default useStore;