36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { IFetchCommunityMember } from "../../api/community";
|
|
import {
|
|
IFetchLoggedUserResponse,
|
|
IFetchUserResponse,
|
|
IFetchUserCommunitiesResponse,
|
|
} from "../../api/user";
|
|
|
|
enum UserActionTypes {
|
|
SET_USER = "SET_USER",
|
|
FETCH_LOGGED_USER_ID_START = "FETCH_LOGGED_USER_ID_START",
|
|
FETCH_LOGGED_USER_ID_FINISH = "FETCH_LOGGED_USER_ID_FINISH",
|
|
FETCH_USER_START = "FETCH_USER_START",
|
|
FETCH_USER_FINISH = "FETCH_USER_FINISH",
|
|
FETCH_USER_COMMUNITIES_START = "FETCH_USER_COMMUNITIES_START",
|
|
FETCH_USER_COMMUNITIES_FINISH = "FETCH_USER_COMMUNITIES_FINISH",
|
|
}
|
|
|
|
type UserAction =
|
|
| {
|
|
type: UserActionTypes.SET_USER;
|
|
payload: IFetchCommunityMember;
|
|
}
|
|
| { type: UserActionTypes.FETCH_LOGGED_USER_ID_START }
|
|
| {
|
|
type: UserActionTypes.FETCH_LOGGED_USER_ID_FINISH;
|
|
payload: IFetchLoggedUserResponse;
|
|
}
|
|
| { type: UserActionTypes.FETCH_USER_START; payload: string }
|
|
| { type: UserActionTypes.FETCH_USER_FINISH; payload: IFetchUserResponse }
|
|
| { type: UserActionTypes.FETCH_USER_COMMUNITIES_START; payload: string }
|
|
| {
|
|
type: UserActionTypes.FETCH_USER_COMMUNITIES_FINISH;
|
|
payload: IFetchUserCommunitiesResponse;
|
|
};
|
|
|
|
export { UserActionTypes, type UserAction };
|