15 lines
363 B
TypeScript
15 lines
363 B
TypeScript
import { Keyword, Prisma } from "@repo/db";
|
|
import axios from "axios";
|
|
|
|
export const getKeywordsAPI = async (filter?: Prisma.KeywordWhereInput) => {
|
|
const res = await axios.get<Keyword[]>("/api/keywords", {
|
|
params: {
|
|
filter: JSON.stringify(filter),
|
|
},
|
|
});
|
|
if (res.status !== 200) {
|
|
throw new Error("Failed to fetch keywords");
|
|
}
|
|
return res.data;
|
|
};
|