added auth
This commit is contained in:
11
src/routes/(protected)/api/united/update/+server.js
Normal file
11
src/routes/(protected)/api/united/update/+server.js
Normal file
@ -0,0 +1,11 @@
|
||||
import { pullData, isRunning } from '$lib/united';
|
||||
|
||||
export async function POST({ request }) {
|
||||
let body = await request.json();
|
||||
const count = body.count || 100;
|
||||
if (isRunning()) {
|
||||
return new Response(`Already running`, { status: 400 });
|
||||
}
|
||||
pullData(count);
|
||||
return new Response(`Started`);
|
||||
}
|
||||
Reference in New Issue
Block a user