reducers typescripting

This commit is contained in:
muerwre 2019-02-12 12:26:04 +07:00
parent 4c6526efc9
commit 85b8860862
15 changed files with 496 additions and 316 deletions

45
src/constants/auth.ts Normal file
View file

@ -0,0 +1,45 @@
type valueof<T> = T[keyof T]
export interface IRoles {
guest: string,
vk: string,
}
export interface IUser {
new_messages: number,
place_types: {},
random_url: string,
role: IRoles[keyof IRoles],
routes: {},
success: boolean,
id?: string,
token?: string,
userdata: {
name: string,
agent: string,
ip: string,
photo: string,
}
}
export const ROLES: IRoles = {
guest: 'guest',
vk: 'vk',
};
export const DEFAULT_USER: IUser = {
new_messages: 0,
place_types: {},
random_url: '',
role: ROLES.guest,
routes: {},
success: false,
id: null,
token: null,
userdata: {
name: '',
agent: '',
ip: '',
photo: '',
}
};