╭∩╮( •̀_•́ )╭∩╮

This commit is contained in:
2024-07-01 00:39:07 +02:00
parent f0c5c81e86
commit 21a99f11d4
4 changed files with 50 additions and 25 deletions

View File

@ -1,5 +1,6 @@
import { defineStore } from 'pinia'
import { type Asset } from '@/types'
import config from '@/config'
export const useAssetStore = defineStore('assets', {
state: () => ({
@ -11,6 +12,16 @@ export const useAssetStore = defineStore('assets', {
},
addAsset(asset: Asset) {
this.assets.push(asset)
},
fetchAssets() {
fetch(config.server_endpoint + '/assets')
.then((response) => response.json())
.then((assets) => {
this.setAssets(assets)
})
.catch((error) => {
console.error('Error fetching assets:', error)
})
}
}
})