49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
'use server';
|
|
import { getClientWithToken } from '../apollo/client';
|
|
import * as GQL from '../types';
|
|
|
|
export async function createSlot(input: GQL.CreateSlotMutationVariables['input']) {
|
|
const { mutate } = await getClientWithToken();
|
|
|
|
return mutate({
|
|
mutation: GQL.CreateSlotDocument,
|
|
variables: { input },
|
|
});
|
|
}
|
|
|
|
export async function getSlots(input: GQL.GetSlotsQueryVariables) {
|
|
const { query } = await getClientWithToken();
|
|
|
|
return query({
|
|
query: GQL.GetSlotsDocument,
|
|
variables: input,
|
|
});
|
|
}
|
|
|
|
export async function getSlot(input: GQL.GetSlotQueryVariables) {
|
|
const { query } = await getClientWithToken();
|
|
|
|
return query({
|
|
query: GQL.GetSlotDocument,
|
|
variables: input,
|
|
});
|
|
}
|
|
|
|
export async function updateSlot(input: GQL.UpdateSlotMutationVariables) {
|
|
const { mutate } = await getClientWithToken();
|
|
|
|
return mutate({
|
|
mutation: GQL.UpdateSlotDocument,
|
|
variables: input,
|
|
});
|
|
}
|
|
|
|
export async function deleteSlot(input: GQL.DeleteSlotMutationVariables) {
|
|
const { mutate } = await getClientWithToken();
|
|
|
|
return mutate({
|
|
mutation: GQL.DeleteSlotDocument,
|
|
variables: input,
|
|
});
|
|
}
|