feat: add resolver to delete user
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
import { Switch, Route } from 'react-router-dom';
|
||||
import { useAuthorizer } from '@authorizerdev/authorizer-react';
|
||||
import Dashboard from './pages/dashboard';
|
||||
@@ -6,30 +6,37 @@ import Login from './pages/login';
|
||||
import ResetPassword from './pages/rest-password';
|
||||
|
||||
export default function Root() {
|
||||
const { token, loading, config } = useAuthorizer();
|
||||
const { token, loading, config } = useAuthorizer();
|
||||
|
||||
if (loading) {
|
||||
return <h1>Loading...</h1>;
|
||||
}
|
||||
useEffect(() => {
|
||||
if (token && config.redirectURL !== window.location.toString()) {
|
||||
window.location.href = config.redirectURL;
|
||||
}
|
||||
return () => {};
|
||||
}, [token]);
|
||||
|
||||
if (token) {
|
||||
return (
|
||||
<Switch>
|
||||
<Route path="/app" exact>
|
||||
<Dashboard />
|
||||
</Route>
|
||||
</Switch>
|
||||
);
|
||||
}
|
||||
if (loading) {
|
||||
return <h1>Loading...</h1>;
|
||||
}
|
||||
|
||||
return (
|
||||
<Switch>
|
||||
<Route path="/app" exact>
|
||||
<Login />
|
||||
</Route>
|
||||
<Route path="/app/reset-password">
|
||||
<ResetPassword />
|
||||
</Route>
|
||||
</Switch>
|
||||
);
|
||||
if (token) {
|
||||
return (
|
||||
<Switch>
|
||||
<Route path="/app" exact>
|
||||
<Dashboard />
|
||||
</Route>
|
||||
</Switch>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Switch>
|
||||
<Route path="/app" exact>
|
||||
<Login />
|
||||
</Route>
|
||||
<Route path="/app/reset-password">
|
||||
<ResetPassword />
|
||||
</Route>
|
||||
</Switch>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user