fix: update fetch URL to use BASE_URL for version tag retrieval (#4448)
* fix: update fetch URL to use BASE_URL for version tag retrieval * feat: add configurable update check URL for better flexibility --------- Co-authored-by: zj <1018zhangjian@gmail.com>pull/48/MERGE
parent
b12ff2d766
commit
f9359ed0f9
|
@ -7,12 +7,15 @@ import { ToastAction, useToast } from '@vben-core/shadcn-ui';
|
||||||
interface Props {
|
interface Props {
|
||||||
// 轮训时间,分钟
|
// 轮训时间,分钟
|
||||||
checkUpdatesInterval?: number;
|
checkUpdatesInterval?: number;
|
||||||
|
// 检查更新的地址
|
||||||
|
checkUpdateUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
defineOptions({ name: 'CheckUpdates' });
|
defineOptions({ name: 'CheckUpdates' });
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
checkUpdatesInterval: 1,
|
checkUpdatesInterval: 1,
|
||||||
|
checkUpdateUrl: import.meta.env.BASE_URL || '/',
|
||||||
});
|
});
|
||||||
|
|
||||||
const lastVersionTag = ref('');
|
const lastVersionTag = ref('');
|
||||||
|
@ -28,7 +31,7 @@ async function getVersionTag() {
|
||||||
) {
|
) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const response = await fetch('/', {
|
const response = await fetch(props.checkUpdateUrl, {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
method: 'HEAD',
|
method: 'HEAD',
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue