mirror of
https://github.com/vladmandic/automatic
synced 2026-08-26 06:30:44 +02:00
431774e6e2
Signed-off-by: Vladimir Mandic <mandic00@live.com>
26 lines
581 B
TypeScript
26 lines
581 B
TypeScript
import { log } from './logger';
|
|
import { authFetch } from './authWrap';
|
|
|
|
interface Model {
|
|
type: string;
|
|
class: string;
|
|
checkpoint: string;
|
|
title: string;
|
|
name: string;
|
|
}
|
|
let lastCheckpoint = '';
|
|
|
|
async function updateUI(model: Model) {
|
|
if (model.checkpoint === lastCheckpoint) return;
|
|
lastCheckpoint = model.checkpoint;
|
|
log('modelUpdate', model);
|
|
}
|
|
|
|
export async function updateModel() {
|
|
const req = await authFetch(`${window.api}/checkpoint`);
|
|
if (req.ok) {
|
|
const model = await req.json() as Model;
|
|
if (model?.type?.length > 0) updateUI(model);
|
|
}
|
|
}
|