This repository has been archived on 2023-11-06. You can view files and clone it, but cannot push or open issues or pull requests.
beatsaber-overlay/pages/api/validateid.js

18 lines
411 B
JavaScript
Raw Normal View History

2022-10-20 17:00:27 +00:00
import { isValidSteamId } from "../../src/helpers/validateSteamId";
2022-10-19 16:15:24 +00:00
export default async function handler(req, res) {
const steamId = req.query.steamid;
if (!steamId) {
2022-10-20 17:00:27 +00:00
return res.status(404).json({
2022-10-19 16:15:24 +00:00
status: 404,
2022-10-20 17:00:27 +00:00
message: "Steam ID not provided",
2022-10-19 16:15:24 +00:00
});
}
2022-10-20 17:00:27 +00:00
const isValid = await isValidSteamId(steamId);
return res.status(200).json({
2022-10-19 16:15:24 +00:00
status: "OK",
2022-10-20 17:00:27 +00:00
message: isValid ? `Valid` : "Invalid",
2022-10-19 16:15:24 +00:00
});
}