-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
43 lines (36 loc) · 1014 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { AnyAction } from "@reduxjs/toolkit";
import { IPayload } from "../payloads";
import { createGlobalUIState, GlobalUIState } from "./globalUIState";
import { ERemoteStatus } from "../enums/system";
export interface State {
[key: string]: any;
}
//for REST API
export interface IRemoteState extends State {
status: ERemoteStatus;
errorCode: number;
msg: string;
tmpData: any; // tempory data store
}
export const createRemoteState = (): IRemoteState => {
return {
status: (ERemoteStatus && ERemoteStatus.IDLE) || 0,
errorCode: null,
msg: "",
tmpData: null,
};
};
export interface RootState extends State {
globalUI: GlobalUIState;
}
export const createRootState = (): RootState => {
return {
globalUI: createGlobalUIState(),
};
};
// for any sync action with type
export interface IReduxAction extends AnyAction {
type: string;
payload?: IPayload;
error?: any;
}