17 lines
450 B
TypeScript
17 lines
450 B
TypeScript
'use server';
|
|
import { createApolloClient } from '../apollo/client';
|
|
import * as GQL from '../types';
|
|
|
|
export async function createSlot(input: GQL.CreateSlotMutationVariables['input']) {
|
|
const { mutate } = await createApolloClient();
|
|
|
|
// TODO: check slot does not overlap with others
|
|
|
|
return mutate({
|
|
mutation: GQL.CreateSlotDocument,
|
|
variables: { input },
|
|
}).catch((err) => {
|
|
console.error(JSON.stringify(err, null, 2));
|
|
});
|
|
}
|