mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 23:17:12 +01:00
add a proper login page
This commit is contained in:
@@ -1,14 +1,35 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { GetServerSideProps } from 'next'
|
||||
import Footer from '../../../../components/footer'
|
||||
import Header from '../../../../components/header'
|
||||
import Calendar from '../../../../components/calendar'
|
||||
import withSession, { isAdminSession } from '../../../../lib/session'
|
||||
import { getServerSideBooking } from '../../../../lib/getServerSideProps'
|
||||
import { BookingDocument } from '../../../../db/booking'
|
||||
import { getBookingStatus } from '../../../../helpers/booking'
|
||||
import { dateFormatFrontend } from '../../../../helpers/date'
|
||||
import { BOOKING_STATUS } from '../../../../db/enums'
|
||||
|
||||
export const getServerSideProps = getServerSideBooking
|
||||
export const getServerSideProps: GetServerSideProps = withSession(
|
||||
async (context) => {
|
||||
const { req, res } = context
|
||||
|
||||
console.error('here')
|
||||
const adminUser = isAdminSession(req, res)
|
||||
|
||||
if (!adminUser) {
|
||||
return { props: {} }
|
||||
}
|
||||
|
||||
const result = await getServerSideBooking(context)
|
||||
return {
|
||||
...result,
|
||||
// TODO: have a closer look at this type issue. Seems like a bug
|
||||
// @ts-ignore
|
||||
props: { ...result.props, user: adminUser },
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
async function patchBooking(uuid: string, bookingData: any) {
|
||||
const response = await fetch(`/api/admin/booking/${uuid}`, {
|
||||
|
||||
Reference in New Issue
Block a user