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>
<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"/>
</q-item>
</q-expansion-item>
@ -245,6 +245,7 @@
}
this.$axios.get('/api/getMyCaches', {params: {token}})
.then((response) => {
console.log(response.data)
this.startedCaches = response.data;
}).catch((error) => {
// Error
@ -270,16 +271,23 @@
})
},
continueCache(cacheID) {
console.log("cacheID")
console.log(cacheID)
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() {
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-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 side top class="self-center">

View File

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

View File

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

View File

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