You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CoreID/app/assets/app/service/Location.service.js

34 lines
832 B

class LocationService {
async redirect(to, delay = 0) {
return new Promise(res => {
setTimeout(() => {
window.location = to
res()
}, delay)
})
}
async back() {
return window.history.back()
}
async reload(delay = 0) {
return new Promise(res => {
setTimeout(() => {
window.location.reload()
res()
}, delay)
})
}
set_query(query) {
if (history.pushState) {
const new_url = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + query;
window.history.pushState({path: new_url}, '', new_url);
}
}
}
const location_service = new LocationService()
export { location_service }