I am storing user locations . when user has internet connection it goes directly to the server and store in database if user is not having internet it gets stored in localstorage and after having internet data uploaded on server.
It works fine with having internet but when i store in localstorage it draws weired lines on map.
code
saveLocation(location){
let data = {
longitude: location?.longitude,
latitude:location?.latitude,
staff_id:TokenService.getUserInfo().id,
work_order_id: TokenService.getWorkOrder(),
deal_id: TokenService.getDealId()
};
let url = `api/save-location`;
var offline_location = { url: url, method: "post", data: data };
let options = {
url: process.env.VUE_APP_ROOT_API+url,
headers: {
Authorization: `Bearer ${TokenService.getToken()}`
},
params: data,
};
if(this.networkStatus){
Http.post(options)
}else{
var today = new Date();
var time = today.getHours() + ":" + today.getMinutes()+
":"+today.getSeconds();
this.$localStorage.set(`save_current_location_store_${time}`,JSON.stringify(offline_location));
}
},