keycloak-demo-frontend/src/reducers/user/types.d.ts

57 lines
1.4 KiB
TypeScript

import USER_ACTION from '@Reducers/_Constants/User';
import User from '@Models/Redux/User';
import { UserAccountInfo, UserOAuthUrl, UserSignOutUrl } from '@Models/Redux/User/types';
import { SetGlobalReduxResetAction } from '@Reducers/global/types';
export type UserState = User;
export interface CreateUserReducerParams {
initialState: UserState;
}
export interface SetUserContentInitialAction {
type: USER_ACTION.SET_USER_INITIALIZE;
}
export interface SetUserLoginStateAction {
type: USER_ACTION.SET_USER_LOGIN_STATE;
isLogin: boolean;
}
export interface SetUserAuthStateAction {
type: USER_ACTION.SET_USER_AUTH_STATE;
isAuth: boolean;
}
export interface SetUserTokenAction {
type: USER_ACTION.SET_USER_TOKEN;
token: string;
}
export interface SetUserAccountInfoAction {
type: USER_ACTION.SET_USER_ACCOUNT_INFO;
accountInfo: UserAccountInfo;
}
export interface SetUserOAuthAction {
type: USER_ACTION.SET_USER_OAUTH_URL;
url: UserOAuthUrl;
}
export interface SetUserSignOutAction {
type: USER_ACTION.SET_USER_SIGN_OUT_URL;
url: UserSignOutUrl;
}
export type UserActionTypes =
| SetUserContentInitialAction
| SetUserLoginStateAction
| SetUserAuthStateAction
| SetUserTokenAction
| SetUserAccountInfoAction
| SetGlobalReduxResetAction
| SetUserOAuthAction
| SetUserSignOutAction;
export { UserAccountInfo, UserOAuthUrl, UserSignOutUrl };