refactor vuex
This commit is contained in:
1 parent
9c69e96416
commit
565b367c59
20 files changed
+264
-178
No files matched your search
@@ -0,0 +1,9 @@
|
||||
import { IApplication } from '@/operators';
|
||||
|
||||
export const setApplications = async ({ commit }: any, payload: IApplication[]) => {
|
||||
commit('setApplications', payload);
|
||||
};
|
||||
|
||||
export default {
|
||||
setApplications
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Module } from 'vuex';
|
||||
import { IChatState } from './models';
|
||||
import state from './state';
|
||||
import actions from './actions';
|
||||
import mutations from './mutations';
|
||||
|
||||
export const chat: Module<IChatState, any> = {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
};
|
||||
|
||||
export default chat;
|
||||
@@ -0,0 +1,7 @@
|
||||
import { IApplication } from '@/operators';
|
||||
import { Status } from '../common/models';
|
||||
|
||||
export interface IChatState {
|
||||
applications: IApplication[] | undefined;
|
||||
applicationsStatus: Status | undefined;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IApplication } from '@/operators';
|
||||
import { IChatState } from './models';
|
||||
import { Status } from '../common/models';
|
||||
|
||||
export const setApplications = (state: IChatState, payload: IApplication[]): void => {
|
||||
state.applications = payload;
|
||||
};
|
||||
|
||||
export const setApplicationsStatus = (state: IChatState, payload: Status): void => {
|
||||
state.applicationsStatus = payload;
|
||||
};
|
||||
|
||||
export default {
|
||||
setApplications,
|
||||
setApplicationsStatus
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { IChatState } from './models';
|
||||
|
||||
export default (): IChatState => {
|
||||
return {
|
||||
applications: undefined,
|
||||
applicationsStatus: undefined
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user