Skip to content

Commit ba5aeda

Browse files
committed
feat: borrow feature
1 parent 9363c3d commit ba5aeda

File tree

8 files changed

+997
-10
lines changed

8 files changed

+997
-10
lines changed

app/(protected)/borrows/new/page.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FormNewBorrow } from '@/components/borrows/FormNewBorrow'
1+
import { FormBorrow } from '@/components/borrows/FormBorrow'
22
import {
33
Breadcrumb,
44
BreadcrumbItem,
@@ -7,9 +7,19 @@ import {
77
BreadcrumbPage,
88
BreadcrumbSeparator,
99
} from '@/components/ui/breadcrumb'
10+
import { IsLoggedIn } from '@/lib/firebase/firebase'
1011
import Link from 'next/link'
12+
import { redirect, RedirectType } from 'next/navigation'
1113

1214
export default async function ComboboxForm() {
15+
const claim = await IsLoggedIn()
16+
if (!claim || !claim.librarease) {
17+
redirect(
18+
`/login?from=${encodeURIComponent('/borrows/new')}`,
19+
RedirectType.replace
20+
)
21+
}
22+
1323
return (
1424
<div className="grid grid-rows-2">
1525
<h1 className="text-2xl font-semibold">Borrow a Book</h1>
@@ -34,7 +44,7 @@ export default async function ComboboxForm() {
3444
</BreadcrumbList>
3545
</Breadcrumb>
3646

37-
<FormNewBorrow />
47+
<FormBorrow {...claim.librarease} />
3848
</div>
3949
)
4050
}

0 commit comments

Comments
 (0)