Open source alternative to Semrush and Ahrefs
TypeScript backlink-analysisgoogle-search-console-mcpkeyword-researchmcpseoseo-agentseo-auditseo-automationseo-skillsseo-toolssite-audit
import { useMutation, type QueryClient } from "@tanstack/react-query";
import { saveKeywords } from "@/serverFunctions/keywords";
export function useSaveKeywordsMutation({
projectId,
queryClient,
}: {
projectId: string;
queryClient: QueryClient;
}) {
return useMutation({
mutationFn: (data: {
projectId: string;
keywords: string[];
locationCode?: number;
metrics?: Array<{
keyword: string;
searchVolume?: number | null;
cpc?: number | null;
keywordDifficulty?: number | null;
}>;
}) => saveKeywords({ data }),
onSuccess: () => {
void queryClient.invalidateQueries({
queryKey: ["savedKeywords", projectId],
});
},
});
}