refactor(api): change error messages to imported constant values
This commit is contained in:
parent
f48ac551f4
commit
6b5b01fdd6
@ -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 { countWords } from "~/lib/functions";
|
||||||
|
import { messages } from "~/lib/server/constants";
|
||||||
import storyQuerier from "~/lib/server/dbHelpers/storyQuerier";
|
import storyQuerier from "~/lib/server/dbHelpers/storyQuerier";
|
||||||
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
import isLoggedIn from "~/lib/server/middlewareButNotReally/isLoggedIn";
|
||||||
import { canModify } from "~/lib/server/middlewareButNotReally/storyPrivileges";
|
import { canModify } from "~/lib/server/middlewareButNotReally/storyPrivileges";
|
||||||
@ -12,7 +13,7 @@ export default eventHandler(async (ev) => {
|
|||||||
if (!canModify(ev, story)) {
|
if (!canModify(ev, story)) {
|
||||||
throw createError({
|
throw createError({
|
||||||
statusCode: 403,
|
statusCode: 403,
|
||||||
message: "Forbidden",
|
message: messages[403],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const body = await readBody(ev);
|
const body = await readBody(ev);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user