fixing auth, switching corporate, table member

This commit is contained in:
Muhammad Fajar
2022-12-12 08:41:53 +07:00
parent f164317b58
commit a3760b8757
17 changed files with 347 additions and 207 deletions

View File

@@ -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

View File

@@ -1,7 +1,7 @@
import { createContext } from 'react';
const UserCurrentCorporateContext = createContext({
corporateValue: '',
corporateValue: '0',
setCorporateValue: (value: string) => Promise<void>,
});