VueTube/NUXT/components/updateChecker.vue

48 lines
904 B
Vue
Raw Normal View History

2022-03-13 20:16:00 +00:00
<template>
2022-03-21 23:47:11 +00:00
<div>
<v-snackbar
v-model="updateSnackbar"
class="updateBar"
:timeout="updateSnackbarTimeout"
>
{{ updateSnackbarText }}
2022-03-13 20:16:00 +00:00
2022-03-21 23:47:11 +00:00
<template #action="{ attrs }">
<v-btn
color="primary"
text
v-bind="attrs"
@click="updateSnackbar = false"
>Close</v-btn
>
</template>
</v-snackbar>
</div>
2022-03-13 20:16:00 +00:00
</template>
<style scoped>
.updateBar {
2022-03-21 23:47:11 +00:00
z-index: 99999999;
2022-03-13 20:16:00 +00:00
}
</style>
<script>
export default {
2022-03-21 23:47:11 +00:00
data() {
return {
updateSnackbar: false,
updateSnackbarText: "An update is available",
updateSnackbarTimeout: 5000,
};
},
2022-03-21 23:47:11 +00:00
async mounted() {
const commits = await this.$vuetube.commits;
const appVersion = process.env.appVersion;
if (appVersion !== commits[0].sha && appVersion !== "dev-local") {
this.updateSnackbar = true;
}
},
};
</script>