40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { Action } from "redux";
|
|
import { User } from "../../types/user";
|
|
|
|
export const FETCH_PROFILE_REQUEST = 'FETCH_PROFILE_REQUEST';
|
|
export const FETCH_PROFILE_SUCCESS = 'FETCH_PROFILE_SUCCESS';
|
|
export const FETCH_PROFILE_FAILURE = 'FETCH_PROFILE_FAILURE';
|
|
|
|
export interface fetchProfileRequestAction extends Action {
|
|
|
|
}
|
|
|
|
export interface fetchProfileSuccessAction extends Action {
|
|
profile: User
|
|
}
|
|
|
|
|
|
export function fetchProfile(): fetchProfileRequestAction {
|
|
return { type: FETCH_PROFILE_REQUEST }
|
|
}
|
|
|
|
export const UPDATE_PROFILE_REQUEST = 'UPDATE_PROFILE_REQUEST';
|
|
export const UPDATE_PROFILE_SUCCESS = 'UPDATE_PROFILE_SUCCESS';
|
|
export const UPDATE_PROFILE_FAILURE = 'UPDATE_PROFILE_FAILURE';
|
|
|
|
export interface ProfileChanges {
|
|
name?: string
|
|
}
|
|
|
|
export interface updateProfileRequestAction extends Action {
|
|
changes: ProfileChanges
|
|
}
|
|
|
|
export interface updateProfileSuccessAction extends Action {
|
|
profile: User
|
|
}
|
|
|
|
|
|
export function updateProfile(changes: ProfileChanges): updateProfileRequestAction {
|
|
return { type: UPDATE_PROFILE_REQUEST, changes }
|
|
} |