Files
graff.estate-nextjs-updated/src/actions/projects/deleteProjectAction.ts
T

20 lines
546 B
TypeScript

'use server';
import { getClient } from '@/lib/apolloClientForSC';
import {
DeleteProjectDocument,
DeleteProjectMutation,
} from '@/queries/projects/deleleProject';
import { revalidatePath } from 'next/cache';
import { cookies } from 'next/headers';
export async function deleteProjectAction(id: number) {
await getClient().mutate<DeleteProjectMutation>({
mutation: DeleteProjectDocument,
variables: { id },
context: { headers: { cookie: cookies().toString() } },
});
revalidatePath('/');
revalidatePath('/projects');
}