feat: check for updates

This commit is contained in:
Timothy J. Baek 2024-02-25 11:55:15 -08:00
parent 6bfe2a6306
commit 759883a4c8
8 changed files with 91 additions and 14 deletions

View file

@ -19,6 +19,10 @@ export const getBackendConfig = async () => {
return null;
});
if (error) {
throw error;
}
return res;
};
@ -41,5 +45,35 @@ export const getChangelog = async () => {
return null;
});
if (error) {
throw error;
}
return res;
};
export const getVersionUpdates = async () => {
let error = null;
const res = await fetch(`${WEBUI_BASE_URL}/api/version/updates`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
console.log(err);
error = err;
return null;
});
if (error) {
throw error;
}
return res;
};