Error boundary
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
"use server";
|
||||
|
||||
import { prisma, Prisma, Station } from "@repo/db";
|
||||
import { prisma, Prisma, Keyword } from "@repo/db";
|
||||
|
||||
export const upsertKeyword = async (
|
||||
station: Prisma.StationCreateInput,
|
||||
id?: Station["id"],
|
||||
keyword: Prisma.KeywordCreateInput,
|
||||
id?: Keyword["id"],
|
||||
) => {
|
||||
const newStation = id
|
||||
? await prisma.station.update({
|
||||
const newKeyword = id
|
||||
? await prisma.keyword.update({
|
||||
where: { id: id },
|
||||
data: station,
|
||||
data: keyword,
|
||||
})
|
||||
: await prisma.station.create({ data: station });
|
||||
return newStation;
|
||||
: await prisma.keyword.create({ data: keyword });
|
||||
return newKeyword;
|
||||
};
|
||||
|
||||
export const deleteStation = async (id: Station["id"]) => {
|
||||
await prisma.station.delete({ where: { id: id } });
|
||||
export const deleteKeyword = async (id: Keyword["id"]) => {
|
||||
await prisma.keyword.delete({ where: { id: id } });
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user