fixed register & continue cache

This commit is contained in:
Timo Volkmann 2019-04-30 19:07:18 +02:00
parent a97b3f1c91
commit 44086c630d
5 changed files with 25 additions and 12 deletions

View File

@ -49,7 +49,7 @@
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item class="q-pr-sm reverse q-gutter-x-sm"> <q-item class="q-pr-sm reverse q-gutter-x-sm">
<q-btn @click="continueCache(startedCache.id)" unelevated color="positive" stack icon="arrow_forward" <q-btn @click="continueCache(startedCache.cache.id)" unelevated color="positive" stack icon="arrow_forward"
label="Fortfahren" size="sm"/> label="Fortfahren" size="sm"/>
</q-item> </q-item>
</q-expansion-item> </q-expansion-item>
@ -245,6 +245,7 @@
} }
this.$axios.get('/api/getMyCaches', {params: {token}}) this.$axios.get('/api/getMyCaches', {params: {token}})
.then((response) => { .then((response) => {
console.log(response.data)
this.startedCaches = response.data; this.startedCaches = response.data;
}).catch((error) => { }).catch((error) => {
// Error // Error
@ -270,16 +271,23 @@
}) })
}, },
continueCache(cacheID) { continueCache(cacheID) {
console.log("cacheID")
console.log(cacheID)
let currentCache; let currentCache;
let params; if (localStorage.getItem('userToken')) {
let params = {cacheID: cacheID};
params.token = JSON.parse(localStorage.getItem('userToken')).token;
this.$axios.get('/api/getCurrentStation', {params})
.then((response) => {
console.log(response.data)
})
.catch((error) => {
});
this.$axios.get('/api/currentStation', {params}) }
.then((response) => {
})
.catch((error) => {
});
this.$router.push({path: `/station/${cacheID}`})
//this.$router.push({path: `/station/${cacheID}`})
}, },
getPersonalRanking() { getPersonalRanking() {
const name = JSON.parse(localStorage.getItem('userToken')).name; const name = JSON.parse(localStorage.getItem('userToken')).name;

View File

@ -36,7 +36,7 @@
<!--<q-icon rounded color="cyan-14" name="location_on" size="3rem"/>--> <!--<q-icon rounded color="cyan-14" name="location_on" size="3rem"/>-->
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
<q-item-label caption>{{ cache.description }}</q-item-label> <q-item-label caption v-html="cache.description"></q-item-label>
</q-item-section> </q-item-section>
<q-item-section side top class="self-center"> <q-item-section side top class="self-center">

View File

@ -50,7 +50,6 @@
label="Sign up" label="Sign up"
color="primary" color="primary"
class="full-width" class="full-width"
type="submit"
@click="register()" @click="register()"
unelevated unelevated
/> />

View File

@ -55,8 +55,11 @@
cacheID: "", cacheID: "",
cacheName: "", cacheName: "",
//cache: null, //cache: null,
cache: null, cache: {
station: null, name: "",
stationen: [],
},
station: {},
// Following Params belong to QR-Code Scanner // Following Params belong to QR-Code Scanner
askForPermission: true, askForPermission: true,

View File

@ -606,7 +606,9 @@ public class Controller {
return ResponseEntity.status(200).body("Ok"); return ResponseEntity.status(200).body("Ok");
} }
@CrossOrigin(origins = "*", allowedHeaders = "*") // only for dev purpose
@RequestMapping("/api/getCurrentStation") @RequestMapping("/api/getCurrentStation")
@ResponseBody
public ResponseEntity getStationFromUserAndCache(@RequestParam String token, @RequestParam String cacheID){ public ResponseEntity getStationFromUserAndCache(@RequestParam String token, @RequestParam String cacheID){
// verify user // verify user
@ -641,6 +643,7 @@ public class Controller {
return ResponseEntity.status(200).body(bearbeitetRepository.findByUserAndCache(user, cache)); return ResponseEntity.status(200).body(bearbeitetRepository.findByUserAndCache(user, cache));
} }
@CrossOrigin(origins = "*", allowedHeaders = "*") // only for dev purpose
@RequestMapping("/api/hello") @RequestMapping("/api/hello")
public ResponseEntity hello(@RequestParam String name) { public ResponseEntity hello(@RequestParam String name) {
return ResponseEntity.status(200).body(userRepository.getRankingPlaceFromUser(name)); return ResponseEntity.status(200).body(userRepository.getRankingPlaceFromUser(name));