mizzkey/src/client/os.ts

24 lines
685 B
TypeScript
Raw Normal View History

2020-09-06 12:30:27 +09:00
import { defineAsyncComponent } from 'vue';
2020-09-06 13:04:44 +09:00
import Stream from '@/scripts/stream';
2020-09-06 12:30:27 +09:00
import { store } from './store';
2020-09-06 13:04:44 +09:00
export const stream = new Stream();
2020-09-06 12:30:27 +09:00
export function api(endpoint: string, data: Record<string, any> = {}, token?: string | null | undefined) {
return store.dispatch('api', { endpoint, data, token });
}
export function dialog(props: Record<string, any>) {
return store.dispatch('showDialog', {
component: defineAsyncComponent(() => import('@/components/dialog.vue')),
props
});
}
export function menu(props: Record<string, any>) {
return store.dispatch('showDialog', {
component: defineAsyncComponent(() => import('@/components/menu.vue')),
props
});
}