-
-
- Shortcuts
-
-
- Members
-
-
- Setting
-
-
-
-
- Add new...
+
+
+
+
+ Shortcuts
+
+
+ Members
+
+
+ Setting
+
+
+
+
+ Add new...
+
+ }
+ actions={
+ <>
+
- }
- actions={
- <>
+ {workspaceUser.role === "ADMIN" && (
- {workspaceUser.role === "ADMIN" && (
-
- )}
- >
- }
- actionsClassName="!w-32"
- />
-
+ )}
+ >
+ }
+ actionsClassName="!w-32"
+ />
- {loadingState.isLoading ? (
-
-
- loading
-
- ) : (
- <>
- {location.hash === "#shortcuts" &&
- (shortcutList.length === 0 ? (
-
-
-
Oops, no shortcut.
-
-
- ) : (
-
- ))}
- {location.hash === "#members" &&
}
- {location.hash === "#setting" &&
}
- >
- )}
+ {loadingState.isLoading ? (
+
+
+ loading
+
+ ) : (
+ <>
+ {location.hash === "#shortcuts" &&
+ (shortcutList.length === 0 ? (
+
+
+
Oops, no shortcut.
+
+
+ ) : (
+
+ ))}
+ {location.hash === "#members" && }
+ {location.hash === "#setting" && }
+ >
+ )}
{state.showCreateShortcutDialog && (
diff --git a/web/src/router/index.tsx b/web/src/router/index.tsx
index 4725959..8ce613c 100644
--- a/web/src/router/index.tsx
+++ b/web/src/router/index.tsx
@@ -1,6 +1,7 @@
import { createBrowserRouter, redirect } from "react-router-dom";
import { isNullorUndefined } from "../helpers/utils";
import { userService, workspaceService } from "../services";
+import Root from "../layout/Root";
import Auth from "../pages/Auth";
import Home from "../pages/Home";
import UserDetail from "../pages/UserDetail";
@@ -14,52 +15,58 @@ const router = createBrowserRouter([
},
{
path: "/",
- element:
,
- loader: async () => {
- try {
- await userService.initialState();
- } catch (error) {
- // do nth
- }
+ element:
,
+ children: [
+ {
+ path: "",
+ element:
,
+ loader: async () => {
+ try {
+ await userService.initialState();
+ } catch (error) {
+ // do nth
+ }
- const { user } = userService.getState();
- if (isNullorUndefined(user)) {
- return redirect("/user/auth");
- }
- },
- },
- {
- path: "/account",
- element:
,
- loader: async () => {
- try {
- await userService.initialState();
- } catch (error) {
- // do nth
- }
+ const { user } = userService.getState();
+ if (isNullorUndefined(user)) {
+ return redirect("/user/auth");
+ }
+ },
+ },
+ {
+ path: "/account",
+ element:
,
+ loader: async () => {
+ try {
+ await userService.initialState();
+ } catch (error) {
+ // do nth
+ }
- const { user } = userService.getState();
- if (isNullorUndefined(user)) {
- return redirect("/user/auth");
- }
- },
- },
- {
- path: "/:workspaceName",
- element:
,
- loader: async () => {
- try {
- await userService.initialState();
- await workspaceService.fetchWorkspaceList();
- } catch (error) {
- // do nth
- }
+ const { user } = userService.getState();
+ if (isNullorUndefined(user)) {
+ return redirect("/user/auth");
+ }
+ },
+ },
+ {
+ path: "/:workspaceName",
+ element:
,
+ loader: async () => {
+ try {
+ await userService.initialState();
+ await workspaceService.fetchWorkspaceList();
+ } catch (error) {
+ // do nth
+ }
- const { user } = userService.getState();
- if (isNullorUndefined(user)) {
- return redirect("/user/auth");
- }
- },
+ const { user } = userService.getState();
+ if (isNullorUndefined(user)) {
+ return redirect("/user/auth");
+ }
+ },
+ },
+ ],
},
{
path: "/:workspaceName/:shortcutName",