mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Update components/checkAppVersion.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
a0cf894a11
commit
17778b6e2e
1 changed files with 8 additions and 4 deletions
|
@ -1,10 +1,14 @@
|
||||||
import currentVersion from "~/versionTag";
|
import currentVersion from "~/versionTag";
|
||||||
|
export default async function newestVersion() {
|
||||||
export default async function newestVersion() {
|
export default async function newestVersion() {
|
||||||
const current = currentVersion();
|
const current = currentVersion();
|
||||||
const req = await fetch("/api/version");
|
const req = await fetch("/api/version");
|
||||||
const res = await req.json();
|
if (!req.ok) {
|
||||||
if (current !== res.version) {
|
console.error("Version check failed:", req.statusText);
|
||||||
return false;
|
return true; // fail-closed → pretend we are up-to-date
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
const { version: latest } = await req.json();
|
||||||
|
return current === latest; // `true` ➜ up-to-date
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue