-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathtodo.ts
41 lines (39 loc) · 921 Bytes
/
todo.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
export interface TodoState {
todos: any[];
loading: boolean;
error: null | string;
page: number;
limit: number;
}
export enum TodoActionTypes {
FETCH_TODOS = 'FETCH_TODOS',
FETCH_TODOS_SUCCESS = 'FETCH_TODOS_SUCCESS',
FETCH_TODOS_ERROR = 'FETCH_TODOS_ERROR',
SET_TODO_PAGE = 'SET_TODO_PAGE'
}
interface FetchTodoAction {
type: TodoActionTypes.FETCH_TODOS
}
interface FetchTodoSuccessAction {
type: TodoActionTypes.FETCH_TODOS_SUCCESS;
payload: any[];
}
interface FetchTodoErrorAction {
type: TodoActionTypes.FETCH_TODOS_ERROR;
payload: string;
}
interface SetTodoPage {
type: TodoActionTypes.SET_TODO_PAGE;
payload: number;
}
export interface TodoModel {
id: number;
userId: number;
title: string;
completed: boolean;
}
export type TodoAction =
FetchTodoAction
| FetchTodoErrorAction
| FetchTodoSuccessAction
| SetTodoPage