Remove user/team transfer from website update.
parent
d60ad1c782
commit
3efd2a5b10
|
@ -15,8 +15,6 @@ export interface WebsiteRequestBody {
|
||||||
name: string;
|
name: string;
|
||||||
domain: string;
|
domain: string;
|
||||||
shareId: string;
|
shareId: string;
|
||||||
userId?: string;
|
|
||||||
teamId?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async (
|
export default async (
|
||||||
|
@ -39,14 +37,10 @@ export default async (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
const { ...data } = req.body;
|
const { name, domain, shareId } = req.body;
|
||||||
|
|
||||||
if (data.userId && data.userId === null && data.teamId && data.teamId === null) {
|
|
||||||
badRequest(res, 'A website must be assigned to a User or Team.');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await updateWebsite(websiteId, data);
|
await updateWebsite(websiteId, { name, domain, shareId });
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
if (e.message.includes('Unique constraint') && e.message.includes('share_id')) {
|
if (e.message.includes('Unique constraint') && e.message.includes('share_id')) {
|
||||||
return serverError(res, 'That share ID is already taken.');
|
return serverError(res, 'That share ID is already taken.');
|
||||||
|
|
Loading…
Reference in New Issue