changed quasar dev port to 8081 and therefor added CORS policy to controller. tested allcaches api
This commit is contained in:
parent
542b3e7209
commit
42e6d72fc3
@ -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
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
<template>
|
||||
<div class="q-pa-md row items-start q-col-gutter-md">
|
||||
|
||||
<div class="col-6">
|
||||
<q-card class="my-card">
|
||||
<q-img src="https://cdn.quasar-framework.org/img/parallax2.jpg">
|
||||
<div class="absolute-bottom">
|
||||
<div class="text-h6">Geocache</div>
|
||||
</div>
|
||||
</q-img>
|
||||
<q-card-actions align="around">
|
||||
<q-btn flat round color="red" icon="favorite" />
|
||||
<q-btn flat round color="teal" icon="bookmark" />
|
||||
<q-btn flat round color="primary" icon="share" />
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</div>
|
||||
|
||||
<div class="col-6" v-for="n in 10" :key="n">
|
||||
<q-card class="my-card">
|
||||
<q-img src="https://cdn.quasar-framework.org/img/parallax2.jpg">
|
||||
<div class="absolute-bottom">
|
||||
<div class="text-h6">Geocache</div>
|
||||
</div>
|
||||
</q-img>
|
||||
<q-card-actions vertical align="around">
|
||||
<q-btn flat color="red" >Action 1</q-btn>
|
||||
<q-btn flat>Action 2</q-btn>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="stylus">
|
||||
.grid-style-transition
|
||||
transition transform .3s
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
denseOn: true,
|
||||
filter: '',
|
||||
selected: [],
|
||||
caches: [],
|
||||
columns: [
|
||||
{
|
||||
name: 'desc',
|
||||
required: true,
|
||||
label: 'Dessert (100g serving)',
|
||||
align: 'left',
|
||||
field: row => row.title,
|
||||
format: val => `${val}`,
|
||||
sortable: true
|
||||
},
|
||||
{ name: 'userId', align: 'center', label: 'ID', field: 'userId', sortable: true },
|
||||
{ name: 'id', label: 'fID', field: 'id', sortable: true },
|
||||
{ name: 'title', label: 'Titel', field: 'title' },
|
||||
{ name: 'completed', label: 'Komplett', field: 'completed' },
|
||||
],
|
||||
// data: [
|
||||
// {
|
||||
// "userId": 1,
|
||||
// "id": 1,
|
||||
// "title": "delectus aut autem",
|
||||
// "completed": false
|
||||
// }
|
||||
// ]
|
||||
}
|
||||
},
|
||||
|
||||
created: function() {
|
||||
this.fetchTodos();
|
||||
},
|
||||
|
||||
methods: {
|
||||
fetchTodos () {
|
||||
this.$axios.get('http://localhost:8080/allCaches')
|
||||
.then((response) => {
|
||||
this.caches = response.data;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -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") }]
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@ -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: {}
|
||||
});
|
||||
|
||||
@ -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(){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user