-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfb3fca
commit 67d5a04
Showing
6 changed files
with
45 additions
and
24 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React, { PropsWithChildren } from "react"; | ||
import { DndProvider } from "react-dnd"; | ||
import { HTML5Backend } from "react-dnd-html5-backend"; | ||
|
||
import Header from "../../components/Header"; | ||
|
||
const Layout: React.FC<PropsWithChildren> = ({ children }) => ( | ||
<> | ||
<Header /> | ||
<DndProvider backend={HTML5Backend}>{children}</DndProvider> | ||
</> | ||
); | ||
|
||
export default Layout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { getCookie } from "lib/cookie"; | ||
import { redirect } from "navi"; | ||
import { useStore } from "pages/FlowEditor/lib/store"; | ||
import React from "react"; | ||
import { View } from "react-navi"; | ||
|
||
import AuthenticatedLayout from "../../pages/layout/AuthenticatedLayout"; | ||
|
||
/** | ||
* View wrapper for all authenticated routes | ||
* Parses JWT and inits user store | ||
*/ | ||
export const authenticatedView = async () => { | ||
const jwt = getCookie("jwt"); | ||
if (!jwt) return redirect("/login"); | ||
|
||
await useStore.getState().initUserStore(jwt); | ||
|
||
return ( | ||
<AuthenticatedLayout> | ||
<View /> | ||
</AuthenticatedLayout> | ||
); | ||
}; |