db authentication replaced by Google
This commit is contained in:
13
app/page.tsx
13
app/page.tsx
@@ -5,6 +5,8 @@ import { AddLocationButton } from './ui/AddLocationButton';
|
||||
import clientPromise from './lib/mongodb';
|
||||
import { BillingLocation } from './lib/db-types';
|
||||
import { PageFooter } from './ui/PageFooter';
|
||||
import { auth } from '@/app/lib/auth.google';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
const getNextYearMonth = (yearMonth:number) => {
|
||||
return(yearMonth % 100 === 12 ? yearMonth + 89 : yearMonth + 1);
|
||||
@@ -12,9 +14,11 @@ const getNextYearMonth = (yearMonth:number) => {
|
||||
|
||||
export const Page = async () => {
|
||||
|
||||
const session = await auth();
|
||||
|
||||
const client = await clientPromise;
|
||||
const db = client.db("rezije");
|
||||
|
||||
|
||||
const locations = await db.collection<BillingLocation>("lokacije")
|
||||
.find({})
|
||||
.sort({ yearMonth: -1, name: 1 }) // sort by yearMonth descending
|
||||
@@ -57,6 +61,13 @@ export const Page = async () => {
|
||||
})
|
||||
}
|
||||
<PageFooter />
|
||||
<ul>
|
||||
<li>session.expires = { session?.expires }</li>
|
||||
<li>session.user.id = { session?.user?.id }</li>
|
||||
<li>session.user.email = { session?.user?.email }</li>
|
||||
<li>session.user.name = { session?.user?.name }</li>
|
||||
<li>session.user.image = { session?.user?.image }</li>
|
||||
</ul>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user