mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 23:17:12 +01:00
move CRUD operations to helpers
This commit is contained in:
@@ -11,7 +11,7 @@ import withSession, {
|
||||
} from '../../../../lib/session'
|
||||
import { getServerSideBooking } from '../../../../lib/getServerSideProps'
|
||||
import { Booking } from '../../../../db/booking'
|
||||
import { getBookingStatus } from '../../../../helpers/booking'
|
||||
import { getBookingStatus, patchBooking } from '../../../../helpers/booking'
|
||||
import { daysFormatFrontend } from '../../../../helpers/date'
|
||||
import { BOOKING_STATUS } from '../../../../db/enums'
|
||||
|
||||
@@ -36,21 +36,6 @@ export const getServerSideProps: GetServerSideProps = withSession(
|
||||
}
|
||||
)
|
||||
|
||||
async function patchBooking(uuid: string, bookingData: any) {
|
||||
const response = await fetch(`/api/admin/booking/${uuid}`, {
|
||||
method: 'PATCH',
|
||||
mode: 'cors',
|
||||
cache: 'no-cache',
|
||||
credentials: 'same-origin',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
referrerPolicy: 'no-referrer',
|
||||
body: JSON.stringify({ ...bookingData }),
|
||||
})
|
||||
return response.json()
|
||||
}
|
||||
|
||||
export default function ShowBookingAdmin({
|
||||
booking: bookingProp,
|
||||
}: {
|
||||
|
||||
Reference in New Issue
Block a user