frontend redesign

This commit is contained in:
ngn
2025-01-07 00:13:11 +03:00
parent 337e56de78
commit fc11748e57
37 changed files with 1545 additions and 900 deletions

View File

@ -1,43 +1,7 @@
import { services } from "$lib/api.js";
export async function load({ fetch }) {
const api = import.meta.env.VITE_API_URL_DEV;
const res = await fetch(api + "/services/all");
const data = await res.json();
if (data["error"] != "") {
return {
error: data["error"],
};
}
// Some really bad code to convert
// [service1, service2, service3...]
// to
// [[service1, service2], [service4, service5], [service4...]...]
// so i can render it in the UI easily
let all = data["result"];
let counter = 0;
let currentlist = [];
let services = [];
for (let i = 0; i < all.length; i++) {
currentlist.push(all[i]);
counter += 1;
if (i == all.length - 1 && counter != 2) {
services.push(currentlist);
}
if (counter == 2) {
services.push(currentlist);
currentlist = [];
counter = 0;
}
}
return {
services,
list: await services(fetch),
};
}