Fetched User data on Login, modified PrivateRoute logic
This commit is contained in:
50
src/actions/user/reducer.actions.js
Normal file
50
src/actions/user/reducer.actions.js
Normal file
@@ -0,0 +1,50 @@
|
||||
import {
|
||||
IS_SENDING_USER_REQUEST,
|
||||
SET_USER_REQUEST_ERROR,
|
||||
CLEAR_USER_REQUEST_ERROR,
|
||||
SET_USER_REQUEST_SUCCESS,
|
||||
CLEAR_USER_REQUEST_SUCCESS,
|
||||
SET_SELF_USER
|
||||
} from "../../constants/user.constants";
|
||||
import { parseError } from "../common.actions";
|
||||
|
||||
export function isSendingUserRequest(sendingRequest) {
|
||||
return {
|
||||
type: IS_SENDING_USER_REQUEST,
|
||||
data: sendingRequest
|
||||
};
|
||||
}
|
||||
|
||||
export function setUserRequestError(exception) {
|
||||
let error = parseError(exception);
|
||||
return {
|
||||
type: SET_USER_REQUEST_ERROR,
|
||||
data: error
|
||||
};
|
||||
}
|
||||
|
||||
export function clearUserRequestError() {
|
||||
return {
|
||||
type: CLEAR_USER_REQUEST_ERROR
|
||||
};
|
||||
}
|
||||
|
||||
export function setUserRequestSuccess(response) {
|
||||
return {
|
||||
type: SET_USER_REQUEST_SUCCESS,
|
||||
data: response.detail || response
|
||||
};
|
||||
}
|
||||
|
||||
export function clearUserRequestSuccess() {
|
||||
return {
|
||||
type: CLEAR_USER_REQUEST_SUCCESS
|
||||
};
|
||||
}
|
||||
|
||||
export function setSelfUser(selfUser) {
|
||||
return {
|
||||
type: SET_SELF_USER,
|
||||
data: selfUser
|
||||
};
|
||||
}
|
7
src/actions/user/saga.actions.js
Normal file
7
src/actions/user/saga.actions.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { SEND_GET_SELF_USER_REQUEST } from "../../constants/user.constants";
|
||||
|
||||
export function sendGetSelfUserRequest() {
|
||||
return {
|
||||
type: SEND_GET_SELF_USER_REQUEST
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user