enh: force refresh page on update

This commit is contained in:
Timothy Jaeryang Baek
2025-11-03 13:43:07 -05:00
parent 67aa1b028d
commit 989f192c92
4 changed files with 53 additions and 13 deletions
+27
View File
@@ -1401,6 +1401,33 @@ export const getChangelog = async () => {
return res;
};
export const getVersion = async (token: string) => {
let error = null;
const res = await fetch(`${WEBUI_BASE_URL}/api/version`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
console.error(err);
error = err;
return null;
});
if (error) {
throw error;
}
return res?.version ?? null;
};
export const getVersionUpdates = async (token: string) => {
let error = null;
+1
View File
@@ -8,6 +8,7 @@ import emojiShortCodes from '$lib/emoji-shortcodes.json';
// Backend
export const WEBUI_NAME = writable(APP_NAME);
export const WEBUI_VERSION = writable(null);
export const config: Writable<Config | undefined> = writable(undefined);
export const user: Writable<SessionUser | undefined> = writable(undefined);