Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #295 from joyent/dustin/v4.x/fix-api-version-requi…
Browse files Browse the repository at this point in the history
…rements-issue

User semver coerce function to normalize the API version number used for comparison
  • Loading branch information
dustinryerson authored Dec 7, 2020
2 parents 36d7561 + f513b70 commit 24de972
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/views/SignIn/SignIn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,13 @@ export default {
},
data() {
return {
apiVersion: '',
badEmailAddress: false,
badPassword: false,
breakingApiVersion: '',
conchReleaseUrl: '',
emailAddress: '',
incompatibleApiVersion: false,
isLoading: false,
minimumApiVersion: '',
password: '',
showHelp: false,
showNotification: true,
Expand Down Expand Up @@ -291,22 +289,13 @@ export default {
},
created() {
this.breakingApiVersion = breakingApiVersion;
this.minimumApiVersion = minimumApiVersion;
this.conchReleaseUrl = conchReleaseUrl;
getApiVersion().then(response => {
const range = `${minimumApiVersion} - ${breakingApiVersion}`;
let apiVersion = response.data.version;
let index;
const { version } = response.data;
if (apiVersion.indexOf('-') !== -1) {
index = apiVersion.indexOf('-');
apiVersion = apiVersion.slice(0, index);
}
this.apiVersion = apiVersion;
if (!semver.satisfies(apiVersion, range)) {
if (!semver.satisfies(semver.coerce(version), range)) {
this.incompatibleApiVersion = true;
}
});
Expand Down

0 comments on commit 24de972

Please sign in to comment.