Link editing.

This commit is contained in:
Mike Cao 2025-08-15 11:11:24 -07:00
parent 0558563d35
commit 5f4b83b09c
13 changed files with 123 additions and 89 deletions

View file

@ -2,7 +2,7 @@ import { z } from 'zod';
import { canUpdateWebsite, canDeleteWebsite, canViewWebsite } from '@/validations';
import { SHARE_ID_REGEX } from '@/lib/constants';
import { parseRequest } from '@/lib/request';
import { ok, json, unauthorized, serverError } from '@/lib/response';
import { ok, json, unauthorized, serverError, badRequest } from '@/lib/response';
import { deleteWebsite, getWebsite, updateWebsite } from '@/queries';
export async function GET(
@ -55,7 +55,7 @@ export async function POST(
return Response.json(website);
} catch (e: any) {
if (e.message.includes('Unique constraint') && e.message.includes('share_id')) {
return serverError(new Error('That share ID is already taken.'));
return badRequest('That share ID is already taken.');
}
return serverError(e);