mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-24 11:21:44 +00:00
clean up
This commit is contained in:
parent
f2f702099f
commit
3a105c79dd
@ -2,11 +2,9 @@ import type { APIResponse } from "$lib/interfaces";
|
||||
import { json, type RequestHandler } from "@sveltejs/kit";
|
||||
|
||||
export const GET: RequestHandler = async ({ url }) => {
|
||||
const response = { success: false } as APIResponse;
|
||||
|
||||
const params = url.searchParams;
|
||||
const endpoint = params.get('endpoint');
|
||||
if (endpoint === null) return json(response);
|
||||
if (endpoint === null) return json({ success: false } as APIResponse);
|
||||
|
||||
const api_call = await fetch(`http://localhost:8080/${endpoint}`);
|
||||
const data = await api_call.json() as APIResponse;
|
||||
@ -14,11 +12,9 @@ export const GET: RequestHandler = async ({ url }) => {
|
||||
};
|
||||
|
||||
export const POST: RequestHandler = async ({ request }) => {
|
||||
const response = { success: false } as APIResponse;
|
||||
|
||||
const formData = await request.formData();
|
||||
const endpoint = formData.get('endpoint');
|
||||
if (endpoint === null) return json(response);
|
||||
if (endpoint === null) return json({ success: false } as APIResponse);
|
||||
|
||||
formData.delete('endpoint');
|
||||
const api_call = await fetch(`http://localhost:8080/${endpoint}`, {
|
||||
|
Loading…
Reference in New Issue
Block a user