Refactor build-and-push.js and deploy.js to improve code structure and update version number in package.json
This commit is contained in:
@@ -5,7 +5,7 @@ import { useMenuStore } from '@/stores/menu'
|
||||
import { RouterView } from 'vue-router'
|
||||
import { useDialogStore } from '@/stores/dialog'
|
||||
import { onMounted } from 'vue'
|
||||
import { version } from '../../package.json'
|
||||
import { getVersion } from '@/utils/api/api.rest'
|
||||
const menu = useMenuStore()
|
||||
const dialog = useDialogStore()
|
||||
|
||||
@@ -23,17 +23,28 @@ const showDialogUpdate = () => {
|
||||
dialog.open = true
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const localVersion = localStorage.getItem('version')
|
||||
if (localVersion) {
|
||||
if (localVersion !== version) {
|
||||
localStorage.setItem('version', version)
|
||||
showDialogUpdate()
|
||||
const checkVersion = () => {
|
||||
getVersion().then((response) => {
|
||||
if (response.data.version) {
|
||||
const version = response.data.version
|
||||
const localVersion = localStorage.getItem('version')
|
||||
if (localVersion) {
|
||||
if (localVersion !== version) {
|
||||
localStorage.setItem('version', version)
|
||||
showDialogUpdate()
|
||||
}
|
||||
} else {
|
||||
localStorage.setItem('version', version)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localStorage.setItem('version', version)
|
||||
}
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
checkVersion()
|
||||
}, 60000)
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => checkVersion())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
Reference in New Issue
Block a user