Changeset View
Changeset View
Standalone View
Standalone View
lib/types/user-types.js
// @flow | // @flow | ||||
import t, { type TInterface, type TDict } from 'tcomb'; | import t, { type TInterface, type TDict, type TUnion } from 'tcomb'; | ||||
import { | import { | ||||
type DefaultNotificationPayload, | type DefaultNotificationPayload, | ||||
defaultNotificationPayloadValidator, | defaultNotificationPayloadValidator, | ||||
} from './account-types.js'; | } from './account-types.js'; | ||||
import { type ClientAvatar, clientAvatarValidator } from './avatar-types.js'; | import { type ClientAvatar, clientAvatarValidator } from './avatar-types.js'; | ||||
import { | import { | ||||
type UserRelationshipStatus, | type UserRelationshipStatus, | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | |||||
export type LoggedOutUserInfo = { | export type LoggedOutUserInfo = { | ||||
+id: string, | +id: string, | ||||
+anonymous: true, | +anonymous: true, | ||||
}; | }; | ||||
export const loggedOutUserInfoValidator: TInterface<LoggedOutUserInfo> = | export const loggedOutUserInfoValidator: TInterface<LoggedOutUserInfo> = | ||||
tShape<LoggedOutUserInfo>({ id: t.String, anonymous: tBool(true) }); | tShape<LoggedOutUserInfo>({ id: t.String, anonymous: tBool(true) }); | ||||
export type OldCurrentUserInfo = OldLoggedInUserInfo | LoggedOutUserInfo; | export type OldCurrentUserInfo = OldLoggedInUserInfo | LoggedOutUserInfo; | ||||
export const oldCurrentUserInfoValidator: TUnion<OldCurrentUserInfo> = t.union([ | |||||
oldLoggedInUserInfoValidator, | |||||
loggedOutUserInfoValidator, | |||||
]); | |||||
export type CurrentUserInfo = LoggedInUserInfo | LoggedOutUserInfo; | export type CurrentUserInfo = LoggedInUserInfo | LoggedOutUserInfo; | ||||
export const currentUserInfoValidator: TUnion<CurrentUserInfo> = t.union([ | |||||
loggedInUserInfoValidator, | |||||
loggedOutUserInfoValidator, | |||||
]); | |||||
export type PasswordUpdate = { | export type PasswordUpdate = { | ||||
+updatedFields: { | +updatedFields: { | ||||
+password?: ?string, | +password?: ?string, | ||||
}, | }, | ||||
+currentPassword: string, | +currentPassword: string, | ||||
}; | }; | ||||
Show All 9 Lines |