Skip to content

Commit 3031da6

Browse files
committed
v0.5.9
1 parent 45b6a0b commit 3031da6

File tree

12 files changed

+717
-599
lines changed

12 files changed

+717
-599
lines changed

index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
module.exports = {
2+
version: {
3+
api: "1.0.0",
4+
},
25
plugins: {},
36
root: {
47
components: "vuefront/lib/components",
@@ -389,6 +392,7 @@ module.exports = {
389392
ManufacturerFilter: "organisms/manufacturer-filter/manufacturer-filter.vue",
390393
},
391394
pages: {
395+
DeprecatedApi: "pages/common/deprecated-api/deprecated-api.vue",
392396
CommonError: "pages/common/error/error.vue",
393397
StoreCheckoutSuccess: "pages/store/checkout-success/checkout-success.vue",
394398
AccountAccount: "pages/account/account/account.vue",
@@ -531,6 +535,7 @@ module.exports = {
531535
},
532536
],
533537
templates: {
538+
CommonDeprecatedApi: "templates/common/deprecated-api/deprecated-api.vue",
534539
StoreCheckoutSuccess:
535540
"templates/store/checkout-success/checkout-success.vue",
536541
CommonLayout: "templates/common/layout/layout.vue",
@@ -630,6 +635,9 @@ module.exports = {
630635
"/404": {
631636
component: "CommonError",
632637
},
638+
"/deprecated-api": {
639+
component: "DeprecatedApi",
640+
},
633641
"/": { component: "CommonHome" },
634642
"/account": {
635643
generate: false,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<vf-t-common-deprecated-api />
3+
</template>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<div class="vf-t-common-deprecated-api">
3+
<vf-a-heading>
4+
The installed version of VueFront requires a newer version of the API.
5+
Installation instructions can be found
6+
<a href="https://vuefront.com/cms" class="text-blues">here</a>.
7+
</vf-a-heading>
8+
</div>
9+
</template>

lib/store/common/vuefront/vuefront.mjs

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import gql from "graphql-tag";
12
export const state = {
23
error: false,
34
ssr: false,
45
sidebar: false,
5-
sidebarCart: false
6+
sidebarCart: false,
7+
version: "1.0.0"
68
};
79
export const mutations = {
810
toggleSidebar(state) {
@@ -31,6 +33,10 @@ export const mutations = {
3133

3234
setSSR(state, payload) {
3335
state.ssr = payload;
36+
},
37+
38+
setVersion(state, payload) {
39+
state.version = payload;
3440
}
3541

3642
};
@@ -49,16 +55,57 @@ export const getters = {
4955

5056
ssr(state) {
5157
return state.ssr;
58+
},
59+
60+
version(state) {
61+
return state.version;
5262
}
5363

5464
};
5565
export const actions = {
56-
async vuefrontInit(_ref) {
66+
async checkVersion(_ref) {
5767
let {
58-
dispatch,
5968
commit
6069
} = _ref;
6170

71+
try {
72+
const {
73+
data
74+
} = await this.$vfapollo.query({
75+
query: gql`
76+
{
77+
version
78+
}
79+
`
80+
});
81+
commit("setVersion", data.version);
82+
} catch (e) {
83+
commit("setVersion", "0.0.1");
84+
}
85+
},
86+
87+
async vuefrontInit(_ref2) {
88+
let {
89+
dispatch,
90+
commit,
91+
getters
92+
} = _ref2;
93+
await dispatch("checkVersion");
94+
95+
if (this.$vuefront.version.api > getters["version"]) {
96+
console.log("deprecated api");
97+
this.$router.push("/deprecated-api");
98+
this.$router.beforeEach((to, from, next) => {
99+
if (to.path !== "/deprecated-api") {
100+
next("/deprecated-api");
101+
return;
102+
}
103+
104+
next();
105+
});
106+
return;
107+
}
108+
62109
if (this.$cookies.get("token")) {
63110
commit("common/customer/setToken", this.$cookies.get("token"), {
64111
root: true
@@ -82,21 +129,21 @@ export const actions = {
82129
}
83130
},
84131

85-
async nuxtServerInit(_ref2) {
132+
async nuxtServerInit(_ref3) {
86133
let {
87134
dispatch,
88135
commit
89-
} = _ref2;
136+
} = _ref3;
90137
await dispatch("vuefrontInit");
91138
commit("setSSR", true);
92139
},
93140

94-
async nuxtClientInit(_ref3) {
141+
async nuxtClientInit(_ref4) {
95142
let {
96143
commit,
97144
dispatch,
98145
rootGetters
99-
} = _ref3;
146+
} = _ref4;
100147
this.$router.beforeEach((to, from, next) => {
101148
if (to.path !== from.path && rootGetters["vuefront/sidebar"]) {
102149
commit("toggleSidebar");

lib/store/common/vuefront/vuefront.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuefront",
3-
"version": "0.5.8",
3+
"version": "0.5.9",
44
"description": "vuefront",
55
"files": [
66
"lib",
@@ -43,7 +43,7 @@
4343
"lodash": "^4.17.21",
4444
"mini-svg-data-uri": "^1.4.3",
4545
"omit-deep-lodash": "^1.1.6",
46-
"tailwindcss": "3.0.17",
46+
"tailwindcss": "3.0.18",
4747
"traverse": "^0.6.6",
4848
"vue-easy-lightbox": "^1.2.3",
4949
"vue-meta": "^3.0.0-alpha.2",
@@ -58,18 +58,18 @@
5858
"@types/faker": "^6.6.8",
5959
"@types/isomorphic-form-data": "^2.0.0",
6060
"@types/lodash": "^4.14.178",
61-
"@types/node": "^17.0.13",
61+
"@types/node": "^17.0.14",
6262
"@types/omit-deep-lodash": "^1.1.1",
63-
"@typescript-eslint/eslint-plugin": "^5.10.1",
64-
"@typescript-eslint/parser": "^5.10.1",
63+
"@typescript-eslint/eslint-plugin": "^5.10.2",
64+
"@typescript-eslint/parser": "^5.10.2",
6565
"autoprefixer": "^10.4.2",
6666
"babel-plugin-detective": "^2.0.0",
6767
"babel-plugin-module-resolver": "^4.1.0",
6868
"babel-plugin-transform-define": "^2.0.1",
6969
"babel-plugin-transform-remove-imports": "^1.7.0",
7070
"concurrently": "^7.0.0",
7171
"cross-env": "^7.0.3",
72-
"eslint": "^8.7.0",
72+
"eslint": "^8.8.0",
7373
"eslint-config-prettier": "^8.3.0",
7474
"eslint-plugin-prettier": "^4.0.0",
7575
"eslint-plugin-vue": "^8.4.0",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<vf-t-common-deprecated-api />
3+
</template>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<div class="vf-t-common-deprecated-api">
3+
<vf-a-heading>
4+
The installed version of VueFront requires a newer version of the API.
5+
Installation instructions can be found
6+
<a href="https://vuefront.com/cms" class="text-blues">here</a>.
7+
</vf-a-heading>
8+
</div>
9+
</template>

0 commit comments

Comments
 (0)