32 lines
781 B
TypeScript
32 lines
781 B
TypeScript
import type { UserResponse, UserStatus } from "../api/types";
|
|
|
|
export type UserListSource = "api" | "local-development";
|
|
export type UserRemovalAction = "deactivate";
|
|
|
|
export interface UserEditFormState {
|
|
displayName: string;
|
|
email: string;
|
|
phone: string;
|
|
qq: string;
|
|
contactNote: string;
|
|
roles: string[];
|
|
status: UserStatus;
|
|
}
|
|
|
|
export interface UserRemovalConfirmationState {
|
|
action: UserRemovalAction;
|
|
user: UserResponse;
|
|
}
|
|
|
|
export function userEditFormFromResponse(user: UserResponse): UserEditFormState {
|
|
return {
|
|
displayName: user.displayName,
|
|
email: user.email ?? "",
|
|
phone: user.profile?.phone ?? "",
|
|
qq: user.profile?.qq ?? "",
|
|
contactNote: user.profile?.contactNote ?? "",
|
|
roles: [...user.roles],
|
|
status: user.status
|
|
};
|
|
}
|