Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit 1673809

Browse files
committed
refactored vuex modules
1 parent d259e58 commit 1673809

File tree

6 files changed

+38
-36
lines changed

6 files changed

+38
-36
lines changed

kubernetes/frontend/deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ spec:
1717
containers:
1818
- name: frontend
1919
imagePullPolicy: IfNotPresent
20-
image: frontend:6
20+
image: frontend:fixed7

quasar/src/router/routes.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import store from "../store";
2-
import router from "../router";
1+
// import store from "../store";
2+
// import router from "../router";
33

44
// for pages that should not be available to logged in users,
55
// such as "Recover password" or a dedicated "Login" page
@@ -12,17 +12,17 @@ import router from "../router";
1212
// next("/");
1313
// };
1414

15-
const ifAuthenticated = (to, from, next) => {
16-
if (store.getters.isAuthenticated) {
17-
next();
18-
return;
19-
}
15+
// const ifAuthenticated = (to, from, next) => {
16+
// if (store.getters.isAuthenticated) {
17+
// next();
18+
// return;
19+
// }
2020

21-
store.commit("setNextLink", { nextLink: to.fullPath });
22-
store.commit("toggleLoginMenu");
23-
router.push("/");
24-
return;
25-
};
21+
// store.commit("setNextLink", { nextLink: to.fullPath });
22+
// store.commit("toggleLoginMenu");
23+
// router.push("/");
24+
// return;
25+
// };
2626

2727
const routes = [
2828
{
@@ -45,7 +45,7 @@ const routes = [
4545
},
4646
{
4747
path: "protected",
48-
beforeEnter: ifAuthenticated,
48+
// beforeEnter: ifAuthenticated,
4949
component: () => import("pages/Protected.vue")
5050
},
5151
{
@@ -62,17 +62,17 @@ const routes = [
6262
},
6363
{
6464
path: "examples/",
65-
beforeEnter: ifAuthenticated,
65+
// beforeEnter: ifAuthenticated,
6666
component: () => import("pages/Examples/index.vue"),
6767
children: [
6868
{
6969
path: "websockets",
70-
beforeEnter: ifAuthenticated,
70+
// beforeEnter: ifAuthenticated,
7171
component: () => import("pages/Examples/Websockets.vue")
7272
},
7373
{
7474
path: "redis",
75-
beforeEnter: ifAuthenticated,
75+
// beforeEnter: ifAuthenticated,
7676
component: () => import("pages/Examples/Redis.vue")
7777
}
7878
]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export const AUTH_ERROR = "AUTH_ERROR";
66
export const AUTH_LOGOUT = "AUTH_LOGOUT";
77
export const AUTH_REFRESH = "AUTH_REFRESH";
88

9-
import apiCall from "../utils/api";
9+
import apiCall from "../../utils/api";
1010
import { Cookies } from "quasar";
11-
import { USER_REQUEST } from "./user.js";
11+
import { USER_REQUEST } from "../user";
1212

1313
const state = {
1414
token: Cookies.get("user-token") || "",

quasar/src/store/index.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Vue from "vue";
22
import Vuex from "vuex";
33
import ui from "./ui";
4-
import auth from "./auth.js";
5-
import user from "./user.js";
4+
import auth from "./auth";
5+
import user from "./user";
66
import social from "./social";
77

88
// import example from './module-example'
@@ -13,16 +13,18 @@ Vue.use(Vuex);
1313
* If not building with SSR mode, you can
1414
* directly export the Store instantiation
1515
*/
16+
export default function(/* { ssrContext } */) {
17+
const Store = new Vuex.Store({
18+
modules: {
19+
ui,
20+
auth,
21+
user,
22+
social
23+
},
1624

17-
export default new Vuex.Store({
18-
modules: {
19-
ui,
20-
auth,
21-
user,
22-
social
23-
},
24-
25-
// enable strict mode (adds overhead!)
26-
// for dev mode only
27-
strict: process.env.DEV
28-
});
25+
// enable strict mode (adds overhead!)
26+
// for dev mode only
27+
strict: process.env.DEV
28+
});
29+
return Store;
30+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import buildURL from "axios/lib/helpers/buildURL";
2-
import oauth from "../utils/oauth";
2+
import oauth from "../../utils/oauth";
33

44
const state = {
55
oauth
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export const USER_SUCCESS = "USER_SUCCESS";
55
export const USER_ERROR = "USER_ERROR";
66

77
import Vue from "vue";
8-
import { AUTH_LOGOUT } from "./auth";
9-
import apiCall from "../utils/api";
8+
import { AUTH_LOGOUT } from "../auth";
9+
import apiCall from "../../utils/api";
1010

1111
const state = {
1212
status: "",

0 commit comments

Comments
 (0)