Refactored queries.

This commit is contained in:
Mike Cao 2023-07-29 22:03:34 -07:00
parent f36a689817
commit 8904b7b4ed
27 changed files with 137 additions and 144 deletions

View file

@ -2,7 +2,7 @@ import { NextApiRequestQueryBody } from 'lib/types';
import { secret } from 'lib/crypto';
import { NextApiResponse } from 'next';
import { createToken, methodNotAllowed, notFound, ok } from 'next-basics';
import { getWebsite } from 'queries';
import { getWebsiteByShareId } from 'queries';
export interface ShareRequestQuery {
id: string;
@ -20,7 +20,7 @@ export default async (
const { id: shareId } = req.query;
if (req.method === 'GET') {
const website = await getWebsite({ shareId });
const website = await getWebsiteByShareId(shareId);
if (website) {
const data = { websiteId: website.id };