This commit is contained in:
jane 2022-05-01 18:19:46 -04:00
parent d0acb97e36
commit 364f31066c
4 changed files with 418 additions and 29 deletions

View file

@ -1,8 +1,13 @@
import NextCors from "nextjs-cors";
import { getBorderById } from "../../../lib/borders";
export default function handler(req, res) {
export default async function handler(req, res) {
const id = req.query.id;
getBorderById(id).then((result) => {
return res.status(200).json(result);
await NextCors(req, res, {
methods: ["GET", "HEAD"],
origin: "*",
optionsSuccessStatus: 200,
});
const result = await getBorderById(id);
return res.status(200).json(result);
}

View file

@ -1,11 +1,17 @@
import NextCors from "nextjs-cors";
import { getByDiscordId } from "../../../../lib/borders";
export default function handler(req, res) {
export default async function handler(req, res) {
const id = req.query.id;
getByDiscordId(id).then((result) => {
const borderUrl = result ?? "0";
return res.status(200).send(borderUrl);
await NextCors(req, res, {
methods: ["GET", "HEAD"],
origin: "*",
optionsSuccessStatus: 200,
});
const result = await getByDiscordId(id);
const borderUrl = result ?? "0";
return res.status(200).send(borderUrl);
}