chat.sad.ovh/src/routes/api/status/[userId]/+server.ts

17 lines
471 B
TypeScript

import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { Status } from '$lib';
export const GET: RequestHandler = async ({ params }) => {
const { userId } = params;
const status = Object.values(Status)[Math.floor(Math.random() * Object.values(Status).length)];
return json({
userId,
status,
lastActive: Date.now() - Math.floor(Math.random() * 600000),
customStatus: Math.random() > 0.5 ? 'vibing 🟢' : null,
});
};