mirror of
https://github.com/KevinMidboe/infra-map.git
synced 2026-01-19 07:36:22 +00:00
working nice. docker uses bun
This commit is contained in:
@@ -1,11 +1,30 @@
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { fetchP1P } from '$lib/server/homeassistant';
|
||||
import { currentFilament } from '$lib/server/filament';
|
||||
import type { Entity } from '$lib/interfaces/homeassistant';
|
||||
import { getAllFilament } from '$lib/server/database';
|
||||
import type { Filament } from '$lib/interfaces/printer';
|
||||
|
||||
export const load: PageServerLoad = async (): Promise<{ p1p: Entity[]; filament: Filament[] }> => {
|
||||
const p1p = await fetchP1P();
|
||||
const filament = currentFilament();
|
||||
interface PrinterState {
|
||||
[key: string]: {
|
||||
value: string;
|
||||
unit?: string;
|
||||
picture?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const load: PageServerLoad = async (): Promise<{
|
||||
p1p: PrinterState;
|
||||
filament: Filament[];
|
||||
}> => {
|
||||
let p1p;
|
||||
let filament: Filament[];
|
||||
|
||||
try {
|
||||
p1p = await fetchP1P();
|
||||
filament = await getAllFilament();
|
||||
} catch (error) {
|
||||
console.error('error while fetching printer server props');
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
return { p1p, filament };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user