🚑 [67174449] Fixes version checking

This commit is contained in:
Alicia Sykes 2021-08-20 00:36:38 +01:00
parent 522bbca427
commit a8cf946f76
2 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="app-version">
<div class="app-version" v-if="isVersionValid()">
<!-- Current Version -->
<p>
{{ $t('updates.app-version-note') }} {{ appVersion }}
@ -31,6 +31,7 @@
<script>
import axios from 'axios';
import ErrorHandler from '@/utils/ErrorHandler';
export default {
name: 'AppInfoModal',
@ -76,6 +77,17 @@ export default {
if (difference > 5) this.veryOutOfDate = true;
return difference <= 0;
},
/* Checks that the input version is correctly parsed */
isVersionValid() {
const isValid = !Number.isNaN(parseInt(this.appVersion.replaceAll('.', ''), 10));
if (!isValid) { // If invalid, then record an error
ErrorHandler(
'Unable to check for updates, because current version is unavailible.'
+ ` ${this.appVersion} is not a valid version.`,
);
}
return isValid;
},
},
};
</script>

View File

@ -5,7 +5,7 @@
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
// Get current version
process.env.VUE_APP_VERSION = require('./package.json');
process.env.VUE_APP_VERSION = require('./package.json').version;
// Specify and export the main Vue app config
module.exports = {