init
This commit is contained in:
27
src/preload/index.ts
Normal file
27
src/preload/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { contextBridge, ipcRenderer } from 'electron'
|
||||
import {
|
||||
IPC_CHANNELS,
|
||||
type AvailabilityQuery,
|
||||
type CancelBookingInput,
|
||||
type CreateBookingInput,
|
||||
type TennisBookApi,
|
||||
type UpdateCourtSettingsInput
|
||||
} from '../shared/contracts'
|
||||
|
||||
const api: TennisBookApi = {
|
||||
listCourts: () => ipcRenderer.invoke(IPC_CHANNELS.listCourts),
|
||||
getAvailability: (query: AvailabilityQuery) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.getAvailability, query),
|
||||
getCourtSettings: (courtId: string) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.getCourtSettings, courtId),
|
||||
updateCourtSettings: (input: UpdateCourtSettingsInput) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.updateCourtSettings, input),
|
||||
createBooking: (input: CreateBookingInput) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.createBooking, input),
|
||||
cancelBooking: (input: CancelBookingInput) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.cancelBooking, input),
|
||||
getPendingBooking: (courtId: string) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.getPendingBooking, courtId)
|
||||
}
|
||||
|
||||
contextBridge.exposeInMainWorld('tennisBook', api)
|
||||
Reference in New Issue
Block a user