Remove all api endpoints from frontend project
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
import { redirect } from "@sveltejs/kit";
|
||||
import type { PageServerLoad } from "./$types";
|
||||
|
||||
export const load: PageServerLoad = async ({locals, fetch}) => {
|
||||
const response = await fetch("/api/createLobby", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(locals.user)
|
||||
});
|
||||
|
||||
if (!response.ok) redirect(307, "/error");
|
||||
|
||||
const lobby = await response.json();
|
||||
|
||||
redirect(307, `/lobby/${lobby.id}`);
|
||||
};
|
||||
Reference in New Issue
Block a user