Переписываю спорные решения
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import React from "react";
|
||||
import {useDispatch, useSelector} from "react-redux";
|
||||
import {getRole} from "../redux/roleSlice";
|
||||
import {useNavigate} from "react-router-dom";
|
||||
@ -12,7 +11,6 @@ export const useLogout = () => {
|
||||
const logout = () => {
|
||||
localStorage.clear();
|
||||
dispatch(auth(false));
|
||||
console.log('logout')
|
||||
navigate(userRole === 'ROLE_DEV' ? '/authdev' : '/auth')
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
import React from "react";
|
||||
import axios from 'axios';
|
||||
import {getToken, urlHasParams} from "../helper";
|
||||
import {useNavigate} from "react-router";
|
||||
import {useLogout} from "./useLogout";
|
||||
|
||||
|
||||
@ -38,7 +36,6 @@ export const useRequest = () => {
|
||||
})
|
||||
.then(response => new Promise(resolve => {
|
||||
if (response.data.redirect || response.status === 401) {
|
||||
console.log(response, 'LOGUTATAT')
|
||||
logout()
|
||||
}
|
||||
return resolve(response)
|
||||
|
Reference in New Issue
Block a user