2022-04-24 02:58:54 +00:00
|
|
|
import { getUserBorders, setUserBorder } from "../../../../lib/borders";
|
2022-04-10 18:26:47 +00:00
|
|
|
|
|
|
|
export default function handler(req, res) {
|
2022-04-24 02:58:54 +00:00
|
|
|
if (req.method === "POST") {
|
|
|
|
setUserBorder(req, req.body).then((result) => {
|
|
|
|
if (result) {
|
|
|
|
return res.status(200).json(result);
|
|
|
|
} else {
|
|
|
|
return res.status(500).json({ error: "could not update border" });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
getUserBorders(req).then((result) => {
|
|
|
|
if (result) {
|
|
|
|
return res.status(200).json(result);
|
|
|
|
} else {
|
|
|
|
return res.status(404).json({ error: "Not Found" });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2022-04-10 18:26:47 +00:00
|
|
|
}
|