fixing auth, switching corporate, table member
This commit is contained in:
@@ -75,11 +75,12 @@ type AuthProviderProps = {
|
||||
|
||||
function AuthProvider({ children }: AuthProviderProps) {
|
||||
const [state, dispatch] = useReducer(JWTReducer, initialState);
|
||||
const accessToken = getSession();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
const accessToken = getSession();
|
||||
// const accessToken = getSession();
|
||||
|
||||
if (accessToken) {
|
||||
setSession(accessToken);
|
||||
@@ -113,7 +114,7 @@ function AuthProvider({ children }: AuthProviderProps) {
|
||||
});
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
}, [accessToken]);
|
||||
|
||||
const login = async (phoneOrEmail: string) =>
|
||||
axios
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createContext } from 'react';
|
||||
|
||||
const UserCurrentCorporateContext = createContext({
|
||||
corporateValue: '',
|
||||
corporateValue: '0',
|
||||
setCorporateValue: (value: string) => Promise<void>,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user