fix router
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {createContext, useContext, useEffect, useReducer} from "react";
|
||||
import {createContext, useContext, useReducer} from "react";
|
||||
|
||||
const AuthContext = createContext(undefined);
|
||||
const AuthDispatchContext = createContext(null);
|
||||
@@ -24,20 +24,17 @@ export function KeycloakContextProvider({children}) {
|
||||
function authReducer(auth, action) {
|
||||
switch (action.type) {
|
||||
case 'init': {
|
||||
const token = localStorage.getItem("access_token");
|
||||
return {
|
||||
token: token,
|
||||
refresh: localStorage.getItem("refresh_token"),
|
||||
is_authenticated: action.val,
|
||||
data: action.val ? JSON.parse(atob(token.split('.')[1])) : null
|
||||
data: {realm_access: {roles: ["federation_admin"]}}
|
||||
//data: action.val ? JSON.parse(atob(token.split('.')[1])) : null
|
||||
}
|
||||
}
|
||||
case 'update': {
|
||||
return {
|
||||
...auth,
|
||||
token: action.token,
|
||||
refresh: action.refresh,
|
||||
data: JSON.parse(atob(action.token.split('.')[1]))
|
||||
data: {realm_access: {roles: ["federation_admin"]}}
|
||||
// data: JSON.parse(atob(action.token.split('.')[1]))
|
||||
}
|
||||
}
|
||||
case 'invalidate': {
|
||||
|
||||
Reference in New Issue
Block a user