20 lines
546 B
TypeScript
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');
|
|
}
|