format code
This commit is contained in:
@@ -5,7 +5,7 @@ class Flatastic {
|
|||||||
this.apikey = apikey;
|
this.apikey = apikey;
|
||||||
}
|
}
|
||||||
|
|
||||||
async request(url: string, option: any) {
|
async request(url: stringany) {
|
||||||
const headers = {
|
const headers = {
|
||||||
accept: "application/json, text/plain, */*",
|
accept: "application/json, text/plain, */*",
|
||||||
"accept-language":
|
"accept-language":
|
||||||
@@ -20,10 +20,8 @@ class Flatastic {
|
|||||||
"x-client-version": "2.3.20",
|
"x-client-version": "2.3.20",
|
||||||
};
|
};
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
...option,
|
|
||||||
headers: {
|
headers: {
|
||||||
...headers,
|
...headers,
|
||||||
...option.headers,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
@@ -35,19 +33,15 @@ class Flatastic {
|
|||||||
getShoppingList() {
|
getShoppingList() {
|
||||||
return this.request(
|
return this.request(
|
||||||
"https://api.flatastic-app.com/index.php/api/shoppinglist",
|
"https://api.flatastic-app.com/index.php/api/shoppinglist",
|
||||||
{},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTaskList() {
|
getTaskList() {
|
||||||
return this.request(
|
return this.request("https://api.flatastic-app.com/index.php/api/chores");
|
||||||
"https://api.flatastic-app.com/index.php/api/chores",
|
|
||||||
{},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getInformation() {
|
getInformation() {
|
||||||
this.request("https://api.flatastic-app.com/index.php/api/wg", {});
|
return this.request("https://api.flatastic-app.com/index.php/api/wg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
|
||||||
import TimetableRow from "../TimetableRow/TimetableRow";
|
import TimetableRow from "@/components/TimetableRow/TimetableRow";
|
||||||
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useKVVStore } from "@/store/kvv";
|
import { useKVVStore } from "@/store/kvv";
|
||||||
import type { DepartureType } from "@/types/departureType";
|
import type { DepartureType } from "@/types/departureType";
|
||||||
|
|
||||||
@@ -39,6 +38,7 @@ export default function Timetable() {
|
|||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
{hStreetData.map((departure, index) => (
|
{hStreetData.map((departure, index) => (
|
||||||
|
// biome-ignore lint/suspicious/noArrayIndexKey: there is no id
|
||||||
<TimetableRow key={index} departure={departure} />
|
<TimetableRow key={index} departure={departure} />
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -47,6 +47,7 @@ export default function Timetable() {
|
|||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
{pStreetData.map((departure, index) => (
|
{pStreetData.map((departure, index) => (
|
||||||
|
// biome-ignore lint/suspicious/noArrayIndexKey: there is no id
|
||||||
<TimetableRow key={index} departure={departure} />
|
<TimetableRow key={index} departure={departure} />
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { createRoot } from "react-dom/client";
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
import App from "./App.tsx";
|
import App from "./App.tsx";
|
||||||
|
|
||||||
|
// biome-ignore lint/style/noNonNullAssertion: if the root element is not found, the app should not render
|
||||||
createRoot(document.getElementById("root")!).render(
|
createRoot(document.getElementById("root")!).render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
<App />
|
<App />
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ const useKVVStore = create(
|
|||||||
const pStreetData = await fetchKvvDepartures(pStreetStopId);
|
const pStreetData = await fetchKvvDepartures(pStreetStopId);
|
||||||
const hStreetJson = await hStreetData.json();
|
const hStreetJson = await hStreetData.json();
|
||||||
const pStreetJson = await pStreetData.json();
|
const pStreetJson = await pStreetData.json();
|
||||||
|
|
||||||
|
console.log("KVV departures fetched:", {
|
||||||
|
hStreet: hStreetJson,
|
||||||
|
pStreet: pStreetJson,
|
||||||
|
});
|
||||||
|
|
||||||
set({
|
set({
|
||||||
hStreet: hStreetJson as DepartureType[],
|
hStreet: hStreetJson as DepartureType[],
|
||||||
pStreet: pStreetJson as DepartureType[],
|
pStreet: pStreetJson as DepartureType[],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import react from "@vitejs/plugin-react-swc";
|
import react from "@vitejs/plugin-react-swc";
|
||||||
import path from "path";
|
import path from "node:path";
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|||||||
Reference in New Issue
Block a user