-
Notifications
You must be signed in to change notification settings - Fork 0
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
48fcea1
commit 91fcfef
Showing
32 changed files
with
880 additions
and
550 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,6 @@ | ||
import { auth } from '@/auth'; | ||
import { ReactNode } from 'react'; | ||
export default async function AdminLayout({ children }: { children: ReactNode }) { | ||
const session = await auth(); | ||
return <>{children}</>; | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,9 +1,19 @@ | ||
import { IBuildInfov2 } from '@/app/builds/_models'; | ||
import { getItems } from '@/utils/db'; | ||
import { getItems, getItemsByQuery } from '@/utils/db'; | ||
|
||
const COLLECTION = 'shipBuildsv2'; | ||
export const getBuilds = async () => { | ||
const items = await getItems<IBuildInfov2>(COLLECTION, 'shipId', 1); | ||
console.log({ items }); | ||
// console.log({ items }); | ||
return items; | ||
}; | ||
|
||
export const getBuildById = async (id: string) => { | ||
const items = await getItemsByQuery<IBuildInfov2>(COLLECTION, { _id: id }); | ||
|
||
if (items.length > 0) { | ||
return items[0]; | ||
} else { | ||
return null; | ||
} | ||
}; |
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,2 @@ | ||
import { handlers } from '@/auth'; | ||
export const { GET, POST } = handlers; |
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,27 @@ | ||
import { Box, Container, Link, Paper, Typography } from '@mui/material'; | ||
import Image from 'next/image'; | ||
import NextLink from 'next/link'; | ||
import notFoundImg from 'public/img/404.jpg'; | ||
|
||
export default function NotAuthorizedPage() { | ||
return ( | ||
<Container maxWidth="lg" sx={{ textAlign: 'center', marginTop: 1 }}> | ||
<Paper> | ||
<Typography variant="h3">Not Authorized</Typography> | ||
<Typography variant="subtitle1"> | ||
You were hyperdicted by the auth patrol... escape destruction by going{' '} | ||
<NextLink href="/home" passHref> | ||
<Link>home</Link> | ||
</NextLink> | ||
. | ||
</Typography> | ||
<Box | ||
sx={{ maxWidth: '100%', height: 'auto' }} | ||
component={Image} | ||
alt="404 Error" | ||
src={notFoundImg} | ||
/> | ||
</Paper> | ||
</Container> | ||
); | ||
} |
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,26 @@ | ||
import { auth } from '@/auth'; | ||
import { redirects } from '@/data/redirects'; | ||
import { redirect } from 'next/navigation'; | ||
import { SignInForm } from './signIn-form'; | ||
|
||
async function redirectIfLoggedIn(redirectKey: string) { | ||
const session = await auth(); | ||
if (session) { | ||
const redirectPath = redirects.find((x) => x.key === redirectKey)?.path; | ||
if (redirectPath) { | ||
redirect(redirectPath); | ||
} else { | ||
redirect('/'); | ||
} | ||
} | ||
} | ||
|
||
export default async function SignInPage({ | ||
searchParams, | ||
}: { | ||
searchParams: { [key: string]: string | string[] | undefined }; | ||
}) { | ||
await redirectIfLoggedIn(searchParams['redirect'] as string); | ||
|
||
return <SignInForm />; | ||
} |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,6 @@ | ||
import { NextAuthConfig } from 'next-auth'; | ||
import SendGrid from 'next-auth/providers/sendgrid'; | ||
|
||
export const authConfig: NextAuthConfig = { | ||
providers: [SendGrid({ from: process.env.EMAIL_FROM })], | ||
}; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.