diff --git a/app/layout.tsx b/app/layout.tsx index bf84489..8a2aaa0 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -5,6 +5,7 @@ import {Metadata} from "next"; import DefaultNavbar from "./common/defaultNavbar"; import { Analytics } from '@vercel/analytics/react'; import type { Viewport } from 'next' +import {Providers} from "./providers"; export const metadata: Metadata = { title: 'Unitystation - The Space Station 13 Remake Made in Unity', @@ -49,8 +50,10 @@ export default function RootLayout({children,}: { children: React.ReactNode; }) - - {children} + + + {children} + diff --git a/app/providers.tsx b/app/providers.tsx new file mode 100644 index 0000000..bced9d9 --- /dev/null +++ b/app/providers.tsx @@ -0,0 +1,13 @@ +'use client' + +import LayoutChildren from "../types/layoutChildren"; +import {AuthorizerContext} from "../context/authorizerContext"; + +export const Providers = (props: LayoutChildren) => { + + return ( + + {props.children} + + ) +} \ No newline at end of file diff --git a/context/authorizerContext.ts b/context/authorizerContext.ts new file mode 100644 index 0000000..674fc14 --- /dev/null +++ b/context/authorizerContext.ts @@ -0,0 +1,7 @@ +import {createContext} from "react"; +import {AuthContext} from "../types/authTypes"; + +export const AuthorizerContext = createContext({ + isLoggedIn: false + } +) \ No newline at end of file diff --git a/types/authTypes.ts b/types/authTypes.ts new file mode 100644 index 0000000..eee0ec7 --- /dev/null +++ b/types/authTypes.ts @@ -0,0 +1,22 @@ +export interface AccountPublicData { + unique_identifier: string; + username: string; + legacy_id?: string; + is_verified: boolean; +} + +export interface LoginResponse { + account: AccountPublicData; + token: string; +} + +export interface LoginWithCredentialsRequest { + email: string; + password: string; +} + +export interface AuthContext { + isLoggedIn: boolean; + account?: AccountPublicData; + encryptedToken?: string; +} \ No newline at end of file