Continues asset loading

This commit is contained in:
Zaxiure
2024-09-19 01:34:07 +02:00
parent 087f007306
commit 4723600327
2 changed files with 58 additions and 16 deletions

View File

@ -22,7 +22,21 @@ export const useAssetStore = defineStore('assets', {
return false
})
},
fetchAssetsByZoneId(zoneId: number) {
fetchAssetsByZoneId2(zoneId: number, successCallback, errorCallback) {
fetch(config.server_endpoint + '/assets/' + zoneId)
.then((response) => response.json())
.then((assets) => {
this.setAssets(assets)
successCallback();
return true
})
.catch((error) => {
errorCallback();
console.error('Error fetching assets:', error)
return false
})
},
async fetchAssetsByZoneId(zoneId: number) {
return fetch(config.server_endpoint + '/assets/' + zoneId)
.then((response) => response.json())
.then((assets) => {