Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Vue from 'vue'
import Vuex from 'vuex'
import ToSemver from 'to-semver'
import LatestSemver from 'latest-semver'
import releases from '../../public/releases.json'
import installMethods from '../../public/install-methods.json'
Vue.use(Vuex)
// storing the latest version since we use it often
let latestRelease = LatestSemver(releases)
export default new Vuex.Store({
state: {
releases: ToSemver(releases),
latestRelease: latestRelease,
selectedDocVersion: latestRelease,
selectedInstallVersion: latestRelease,
installMethods: installMethods,
requestADemoEndpoint: 'https://script.google.com/macros/s/AKfycbwiFfaiSK6JqdNqZLAt5PRayPV43x7qw1ZAM_-sFSDg6IT44d4/exec',
newsletterSignupEndpoint: 'https://script.google.com/macros/s/AKfycbx9xikTdHNrrnHiqxNX3ecVkTJYzPmKemrz2OMr6SaOXT7FYaiM/exec'
},
getters: {
getInstallMethods: (state) => state.installMethods,
getReleaseList: (state) => state.releases,
getLatestRelease: (state) => state.latestRelease,
export async function getLatestReactionRelease() {
try {
const res = await fetch('https://api.github.com/repos/reactioncommerce/reaction/releases');
const releases = await res.json();
const tags = [];
releases.forEach((r) => tags.push(r.tag_name));
return getLatest(tags);
} catch (err) {
return null;
}
}