diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index 51b4962..de6b87d 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -87,8 +87,8 @@ module.exports = function (ctx) { devServer: { // https: true, - // port: 8080, - open: false // opens browser window automatically + port: 8081, + open: true // opens browser window automatically }, // animations: 'all' --- includes all animations diff --git a/frontend/src/pages/Index.vue b/frontend/src/pages/Index.vue deleted file mode 100644 index 3e0e4ae..0000000 --- a/frontend/src/pages/Index.vue +++ /dev/null @@ -1,88 +0,0 @@ - - - - - diff --git a/frontend/src/router/routes.js b/frontend/src/router/routes.js index 8571b3d..554e56b 100644 --- a/frontend/src/router/routes.js +++ b/frontend/src/router/routes.js @@ -8,6 +8,11 @@ const routes = [ path: "/dashboard/", component: () => import("layouts/MyLayout.vue"), children: [{ path: "", component: () => import("pages/Dashboard.vue") }] + }, + { + path: "/testcaches/", + component: () => import("layouts/MyLayout.vue"), + children: [{ path: "", component: () => import("pages/TestCaches.vue") }] } ]; diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index ca79aab..e8a81c7 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -1,25 +1,51 @@ import Vue from "vue"; import Vuex from "vuex"; +import Axios from "axios"; // import example from './module-example' -Vue.use(Vuex); +Vue.use(Vuex, Axios); /* * If not building with SSR mode, you can * directly export the Store instantiation */ -export default function(/* { ssrContext } */) { - const Store = new Vuex.Store({ - modules: { - // example +// export default function(/* { ssrContext } */) { +// const Store = new Vuex.Store({ +// modules: { +// // example +// }, +// +// // enable strict mode (adds overhead!) +// // for dev mode only +// strict: process.env.DEV +// }); +// +// return Store; +// } + +export default new Vuex.Store({ + state: { + caches: [], + userToken: "", + userAuthenticated: true + }, + actions: {}, + mutations: { + checkAuth(state) { + console.log("checkAuth()"); + state.userAuthenticated = !state.userToken.isEmpty(); }, - - // enable strict mode (adds overhead!) - // for dev mode only - strict: process.env.DEV - }); - - return Store; -} + setUserToken(state, token) { + console.log("setUserToken()"); + state.userToken = token; + this.checkAuth(state); + } + }, + getters: { + userToken: state => state.userToken, + userAuthenticated: state => state.userAuthenticated + }, + modules: {} +}); diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index 8103518..9a03c55 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -5,6 +5,7 @@ import hhn.labsw.bugageocaching.repositories.CacheRepository; import hhn.labsw.bugageocaching.repositories.RewardRepository; import hhn.labsw.bugageocaching.repositories.StationRepository; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; @@ -21,6 +22,7 @@ public class Controller { @Autowired StationRepository stationRepository; + @CrossOrigin(origins = "http://localhost:8081") // only for dev purpose @RequestMapping("/allCaches") @ResponseBody public String getAllCaches(){