fix: 🐛 added hostname to api requests and renamed drivertype to be used properly
This commit is contained in:
parent
279bf5944e
commit
77cf71e288
2
.gitignore
vendored
2
.gitignore
vendored
@ -27,7 +27,7 @@ share/python-wheels/
|
|||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
*.js
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
@ -48,7 +48,7 @@ export default defineComponent({
|
|||||||
formData.append("driverId", selectedDriver.value.toString());
|
formData.append("driverId", selectedDriver.value.toString());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/track', {
|
const response = await fetch('http://localhost:5000/track', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData,
|
body: formData,
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,7 @@ import '@vuepic/vue-datepicker/dist/main.css'
|
|||||||
import Map from '../components/map.vue';
|
import Map from '../components/map.vue';
|
||||||
import FileUpload from '../components/fileUpload.vue';
|
import FileUpload from '../components/fileUpload.vue';
|
||||||
|
|
||||||
type driver = {
|
type DriverType = {
|
||||||
id:number
|
id:number
|
||||||
name:string
|
name:string
|
||||||
}
|
}
|
||||||
@ -14,7 +14,7 @@ type driver = {
|
|||||||
type track = {
|
type track = {
|
||||||
id:number
|
id:number
|
||||||
name:string
|
name:string
|
||||||
driver: driver
|
driver: DriverType
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@ -24,7 +24,7 @@ export default defineComponent({
|
|||||||
const showMap:Ref<boolean> = ref(false);
|
const showMap:Ref<boolean> = ref(false);
|
||||||
const showCloud:Ref<boolean> = ref(false);
|
const showCloud:Ref<boolean> = ref(false);
|
||||||
const search:Ref<boolean> = ref(false);
|
const search:Ref<boolean> = ref(false);
|
||||||
const showUpload:Ref<boolean> = ref(true);
|
const showUpload:Ref<boolean> = ref(false);
|
||||||
const tracks:Ref<track[]> = ref([])
|
const tracks:Ref<track[]> = ref([])
|
||||||
const startSearchDate = ref();
|
const startSearchDate = ref();
|
||||||
const endSearchDate = ref();
|
const endSearchDate = ref();
|
||||||
@ -40,7 +40,7 @@ export default defineComponent({
|
|||||||
headers.set('Content-Type', 'application/json')
|
headers.set('Content-Type', 'application/json')
|
||||||
headers.set('Accept', 'application/json')
|
headers.set('Accept', 'application/json')
|
||||||
|
|
||||||
const request: RequestInfo = new Request("/track?id=" + id, {
|
const request: RequestInfo = new Request("http://localhost:5000/track?id=" + id, {
|
||||||
method:"GET",
|
method:"GET",
|
||||||
headers:headers
|
headers:headers
|
||||||
})
|
})
|
||||||
@ -52,7 +52,7 @@ export default defineComponent({
|
|||||||
// convert vehicles from json response to processable data
|
// convert vehicles from json response to processable data
|
||||||
mapData.value = await response.json()
|
mapData.value = await response.json()
|
||||||
} else {
|
} else {
|
||||||
alert(response.text)
|
console.log(await response.text())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ export default defineComponent({
|
|||||||
headers.set('Content-Type', 'application/json')
|
headers.set('Content-Type', 'application/json')
|
||||||
headers.set('Accept', 'application/json')
|
headers.set('Accept', 'application/json')
|
||||||
|
|
||||||
const request: RequestInfo = new Request("/track", {
|
const request: RequestInfo = new Request("http://localhost:5000/track", {
|
||||||
method:"GET",
|
method:"GET",
|
||||||
headers:headers
|
headers:headers
|
||||||
})
|
})
|
||||||
@ -74,10 +74,12 @@ export default defineComponent({
|
|||||||
|
|
||||||
// convert vehicles from json response to processable data
|
// convert vehicles from json response to processable data
|
||||||
for(let i = 0; i < jsonBody.length; i++) {
|
for(let i = 0; i < jsonBody.length; i++) {
|
||||||
tracks.value.push({id: jsonBody[i]["id"], name: jsonBody[i]["name"]})
|
tracks.value.push({id: jsonBody[i]["id"], name: jsonBody[i]["name"], driver: {
|
||||||
|
id: jsonBody[i]["driver"]["id"], name: jsonBody[i]["driver"]["name"]
|
||||||
|
}})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alert(response.text)
|
console.log(await response.text())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +88,7 @@ export default defineComponent({
|
|||||||
headers.set('Content-Type', 'application/json')
|
headers.set('Content-Type', 'application/json')
|
||||||
headers.set('Accept', 'application/json')
|
headers.set('Accept', 'application/json')
|
||||||
|
|
||||||
const request: RequestInfo = new Request("/track?start="+startSearchDate.value+"&end="+endSearchDate.value, {
|
const request: RequestInfo = new Request("http://localhost:5000/track?start="+startSearchDate.value+"&end="+endSearchDate.value, {
|
||||||
method:"GET",
|
method:"GET",
|
||||||
headers:headers
|
headers:headers
|
||||||
})
|
})
|
||||||
@ -108,7 +110,7 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alert(response.text)
|
console.log(await response.text())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user