1
0
forked from noxious/client

Use Dexie instead of Pinia store values in tileList inside mapEditor

This commit is contained in:
2025-01-25 13:49:03 +01:00
parent 9cdfcbcc56
commit 69f9944dc7
5 changed files with 37 additions and 21 deletions

View File

@ -30,9 +30,11 @@ import { useAssetManagerStore } from '@/stores/assetManagerStore'
import { useGameStore } from '@/stores/gameStore'
import { useMapEditorStore } from '@/stores/mapEditorStore'
import { computed, onBeforeUnmount, onMounted, ref, toRaw, watch } from 'vue'
import { TileStorage } from '@/storage/storages'
const gameStore = useGameStore()
const assetManagerStore = useAssetManagerStore()
const tileStorage = new TileStorage()
const selectedTile = computed(() => assetManagerStore.selectedTile)
@ -54,12 +56,13 @@ watch(selectedTile, (tile: Tile | null) => {
tileTags.value = tile.tags
})
function deleteTile() {
gameStore.connection?.emit('gm:tile:delete', { id: selectedTile.value?.id }, (response: boolean) => {
async function deleteTile() {
gameStore.connection?.emit('gm:tile:delete', { id: selectedTile.value?.id }, async (response: boolean) => {
if (!response) {
console.error('Failed to delete tile')
return
}
await tileStorage.delete(selectedTile.value!.id)
refreshTileList()
})
}