- added console logs;

This commit is contained in:
Vitalii Kiiko
2024-10-09 10:18:00 +02:00
parent fa29164fed
commit 58303425ac
4 changed files with 8 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ function App() {
const role = useStore().main.getRole();
const callback = (data) => {
console.log('app /me', data);
if (data.status === 'SUCCESS') {
storeSet.main.userData(data.data);
} else {
@@ -51,6 +52,7 @@ function App() {
useEffect(() => {
storeSet.main.setAsyncRequest();
console.log('app loaded, initiate call to /me');
AuthenticationService.me(callback, errCallback);
fetch('/languages/en_US.json')

View File

@@ -27,6 +27,7 @@ const Login = () => {
}
const validateCallback = (data) => {
console.log('login validateCallback', data)
if (data.status === 'SUCCESS') {
storeSet.main.setAuthData({
token: data.data.token,
@@ -63,7 +64,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);

View File

@@ -38,6 +38,7 @@ const LoginAdmin = () => {
};
const loginCallback = (data) => {
console.log('loginCallback', data);
if (data.status === 'SUCCESS') {
storeSet.main.setAuthData({
token: data.data.token,
@@ -63,8 +64,10 @@ const LoginAdmin = () => {
}
useEffect(() => {
console.log('login admin, updated token:', token);
if (!isEmpty(token)) {
setLoading(true);
console.log('login admin, do redirect to "/"');
window.location.replace('/')
}
}, [token]);

View File

@@ -334,6 +334,7 @@ export class NetworkService {
})
.then(async response => {
let status = response.status;
console.log('status in fetch:', status)
return { response: await response.json(), status: status }
})
.then(data => {