-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.d.ts
80 lines (67 loc) · 1.49 KB
/
types.d.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Best to not convert Timestamp objects and Date objects back and fourth
// Timestamp: nanoseconds
// Date: milliseconds
type AuthState = {
createAccount: boolean,
signedIn: boolean,
createInfo: UserInfo,
signInInfo: UserInfo,
registerAccount: () => void | Promise<Error>,
signIn: () => void | Promise<Error>,
signInPop: () => void | Promise<Error>,
logOut: () => void,
}
type CommentObj = {
dateMS: number,
body: string,
userEmail: string,
postId: string,
id?: string
}
type HTTP = 'GET' | 'POST' | 'PATCH' | 'DELETE'
type Navi = 'explore' | 'following' | 'main'
type Params = {
params: {
[key: string]: string
}
}
type PostObj = {
dateMS: number,
title: string,
body: string,
userId: string,
userEmail: string,
id?: string,
}
type QuickParam = {
dateMS: number,
[key: string] : any
}[]
type Status = {
status: number,
headers: {
"Content-Type" : string
}
}
type UserInfo = {
email: string,
password: string,
userName?: string,
}
type UserObj = {
id: string,
userEmail: string,
subscribedTo: string[]
}
type UserState = {
userInfo: UserObj,
userPosts: PostObj[],
updateUserInfo: (userId: string) => void | Promise<Error>,
createUserInfo: (userId: string, userEmail: string) => void,
updateUserPosts: (userId: string) => void,
}
interface UserReqObj extends UserObj {
id: string,
otherUserId: string,
PATCHMethod: 'add' | 'delete'
}