feat: add resolver to delete user

This commit is contained in:
Lakhan Samani
2021-08-06 19:17:52 +05:30
parent 104adfea1d
commit 9473268654
12 changed files with 361 additions and 180 deletions

View File

@@ -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>
);
}