Compare commits
No commits in common. "e95281c50df2d394017eb94d2e4469232574d1d2" and "f3fe52b11840b984bb230df456a5d89d258e4ce9" have entirely different histories.
e95281c50d
...
f3fe52b118
@ -1,27 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: get all poi
|
|
||||||
type: http
|
|
||||||
seq: 5
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: {{PB_URL}}/api/collections/user_poi/records?filter=owner='vvy93m1hoaeshwy'&&poi_list='cabkkovmjsfoapa'
|
|
||||||
body: json
|
|
||||||
auth: bearer
|
|
||||||
}
|
|
||||||
|
|
||||||
query {
|
|
||||||
filter: owner
|
|
||||||
poi_list: 'cabkkovmjsfoapa'
|
|
||||||
}
|
|
||||||
|
|
||||||
auth:bearer {
|
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb2xsZWN0aW9uSWQiOiJfcGJfdXNlcnNfYXV0aF8iLCJleHAiOjE3MTg4Mjg0NzEsImlkIjoidnZ5OTNtMWhvYWVzaHd5IiwidHlwZSI6ImF1dGhSZWNvcmQifQ.pC7u-QaZ_BYqWA5wG8wu1lRbbd4mKuKeAveWe_IBnfU
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"owner": "vvy93m1hoaeshwy",
|
|
||||||
"poi_list": "sh430u0im37cxm5"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: send fav to astro
|
|
||||||
type: http
|
|
||||||
seq: 4
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/maps/save_poi
|
|
||||||
body: json
|
|
||||||
auth: bearer
|
|
||||||
}
|
|
||||||
|
|
||||||
auth:bearer {
|
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb2xsZWN0aW9uSWQiOiJfcGJfdXNlcnNfYXV0aF8iLCJleHAiOjE3MTg4ODY2OTIsImlkIjoidnZ5OTNtMWhvYWVzaHd5IiwidHlwZSI6ImF1dGhSZWNvcmQifQ.R9PBGlHn6aBHt89g6G0NykMh_Vye24OpKEUYtz6R6Og
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"type": "Feature",
|
|
||||||
"id": "11472888",
|
|
||||||
"geometry": {
|
|
||||||
"type": "Point",
|
|
||||||
"coordinates": [
|
|
||||||
-0.0626024,
|
|
||||||
51.4924088
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"xid": "W544344833",
|
|
||||||
"name": "The Blue Anchor",
|
|
||||||
"rate": 2,
|
|
||||||
"osm": "way/544344833",
|
|
||||||
"wikidata": "Q7718716",
|
|
||||||
"kinds": "pubs,foods,shops,marketplaces,tourist_facilities"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
---
|
|
||||||
import AstroUtils from "libs/AstroUtils";
|
|
||||||
import type { RecordModel } from "pocketbase";
|
|
||||||
|
|
||||||
|
|
||||||
const pb = Astro.locals.pb
|
|
||||||
|
|
||||||
if(!pb.authStore.isValid){
|
|
||||||
return Astro.redirect("/account")
|
|
||||||
}
|
|
||||||
|
|
||||||
await AstroUtils.wrap(async () => {
|
|
||||||
if (Astro.request.method !== 'POST') {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const poiJson = await Astro.request.json()
|
|
||||||
|
|
||||||
const data = {Poi: poiJson.Poi, Poi_id:poiJson.Poi.id}
|
|
||||||
|
|
||||||
let record: RecordModel
|
|
||||||
|
|
||||||
try {
|
|
||||||
record = await pb.collection('POI').create(data);
|
|
||||||
} catch (error) {
|
|
||||||
try{
|
|
||||||
record = await pb.collection('POI').getFirstListItem(`Poi_id="${poiJson.Poi.id}"`)
|
|
||||||
} catch (error2) {
|
|
||||||
console.log("error 1 :")
|
|
||||||
console.log(error)
|
|
||||||
console.log("error 2 :")
|
|
||||||
console.log(error2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if(poiJson.save){
|
|
||||||
pb.collection('user_poi').create({owner: pb.authStore.model!.id, poi_list:record!.id})
|
|
||||||
}else{
|
|
||||||
record = await pb.collection('user_poi').getFirstListItem(`poi_list="${record!.id}"&&owner="${pb.authStore.model!.id}"`)
|
|
||||||
pb.collection('user_poi').delete(record.id)
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
---
|
|
Loading…
x
Reference in New Issue
Block a user