refactor(api): change error messages to imported constant values

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2023-10-03 01:17:21 -04:00
parent f48ac551f4
commit 6b5b01fdd6
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

@ -1,5 +1,6 @@
import { FormChapter } from "~/lib/client/types/FormStory";
import { FormChapter } from "~/lib/client/types/form/story";
import { countWords } from "~/lib/functions";
import { messages } from "~/lib/server/constants";
import storyQuerier from "~/lib/server/dbHelpers/storyQuerier";
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
import { canModify } from "~/lib/server/middlewareButNotReally/storyPrivileges";
@ -12,7 +13,7 @@ export default eventHandler(async (ev) => {
if (!canModify(ev, story)) {
throw createError({
statusCode: 403,
message: "Forbidden",
message: messages[403],
});
}
const body = await readBody(ev);