- updated auth logic;
This commit is contained in:
@@ -41,7 +41,6 @@ const Login = () => {
|
||||
}
|
||||
|
||||
const validateCallback = (data) => {
|
||||
//console.log('login validateCallback', data)
|
||||
if (data.status === 'SUCCESS') {
|
||||
storeSet('setAuthData', {
|
||||
token: data.data.token,
|
||||
@@ -107,7 +106,7 @@ const Login = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const temp_token = searchParams.get('temp_token');
|
||||
//console.log('login temp_token', temp_token);
|
||||
|
||||
if (!isNil(temp_token) && !isEmpty(temp_token)) {
|
||||
errorMsgs.current.clear();
|
||||
AuthenticationService.validateExistingUser(temp_token, validateCallback, validateError);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { storeGet, storeSet } from '../store';
|
||||
import logMsgWithSentry from '../helpers/logMsgWithSentry';
|
||||
import { isEmpty } from 'ramda';
|
||||
|
||||
export class NetworkService {
|
||||
|
||||
@@ -257,6 +258,10 @@ export class NetworkService {
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
|
||||
if (url.includes('user/me') && isEmpty(storeGet('getToken'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(url, {
|
||||
method: 'GET',
|
||||
mode: 'cors',
|
||||
|
||||
@@ -13,18 +13,12 @@ export const actionsAlpha = ({ set, get }) => ({
|
||||
|
||||
export const actionsBeta = ({ set, get }) => ({
|
||||
setAuthData: ({ userData, token }) => {
|
||||
set('state', (draft) => {
|
||||
draft.userData = userData;
|
||||
draft.token = token;
|
||||
return draft;
|
||||
});
|
||||
set('token', token);
|
||||
set('userData', userData);
|
||||
},
|
||||
doLogout: () => {
|
||||
set('state', (draft) => {
|
||||
draft.userData = {};
|
||||
draft.token = '';
|
||||
return draft;
|
||||
});
|
||||
set('token', '');
|
||||
set('userData', {});
|
||||
},
|
||||
removeElement: (id) => {
|
||||
const elements = get('formElements');
|
||||
|
||||
Reference in New Issue
Block a user