refactor: publish boards
This commit is contained in:
parent
2b196ba1f1
commit
a2fbd6132b
13 changed files with 187 additions and 177 deletions
|
|
@ -1,43 +1,20 @@
|
|||
// components
|
||||
import { UserLoggedIn } from "@/components/accounts";
|
||||
import { InstanceNotReady, InstanceFailureView } from "@/components/instance";
|
||||
import { AuthView } from "@/components/views";
|
||||
// helpers
|
||||
// import { EPageTypes } from "@/helpers/authentication.helper";
|
||||
// import { useInstance, useUser } from "@/hooks/store";
|
||||
// wrapper
|
||||
// import { AuthWrapper } from "@/lib/wrappers";
|
||||
// lib
|
||||
import { AppProvider } from "@/lib/app-providers";
|
||||
// services
|
||||
import { InstanceService } from "@/services/instance.service";
|
||||
import { UserService } from "@/services/user.service";
|
||||
|
||||
const userServices = new UserService();
|
||||
const instanceService = new InstanceService();
|
||||
|
||||
export default async function HomePage() {
|
||||
const instanceDetails = await instanceService.getInstanceInfo().catch(() => undefined);
|
||||
const user = await userServices
|
||||
.currentUser()
|
||||
.then((user) => ({ ...user, isAuthenticated: true }))
|
||||
.catch(() => ({ isAuthenticated: false }));
|
||||
|
||||
if (!instanceDetails) {
|
||||
return <InstanceFailureView />;
|
||||
}
|
||||
|
||||
if (!instanceDetails?.instance?.is_setup_done) {
|
||||
<InstanceNotReady />;
|
||||
}
|
||||
|
||||
if (user.isAuthenticated) {
|
||||
return <UserLoggedIn />;
|
||||
}
|
||||
|
||||
return (
|
||||
<AppProvider initialState={{ instance: instanceDetails.instance }}>
|
||||
<AuthView />
|
||||
</AppProvider>
|
||||
);
|
||||
return <AuthView />;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue