umami/pages/api/user.js

14 lines
298 B
JavaScript
Raw Normal View History

import { parseSecureToken } from 'lib/crypto';
import { ok, badRequest } from 'lib/response';
2020-07-23 06:33:17 +02:00
export default async (req, res) => {
const { token } = req.body;
try {
const payload = await parseSecureToken(token);
return ok(res, payload);
2020-07-23 06:33:17 +02:00
} catch {
return badRequest(res);
2020-07-23 06:33:17 +02:00
}
};