rule book ui

This commit is contained in:
Sirttas
2026-05-24 13:39:35 +02:00
parent a1dbe41b6c
commit 4b39d491d2
15 changed files with 524 additions and 17 deletions
+9 -1
View File
@@ -8,7 +8,15 @@ export type Character = CharacterResponse
export const useCharactersStore = defineStore('characters', () => {
const characters = ref<Character[]>([]);
const findById = (characterId: number): Character | undefined => characters.value.find(c => c.characterId === characterId);
const findById = async (characterId: number): Promise<Character | undefined> => {
let character = characters.value.find(c => c.characterId === characterId);
if (!character) {
await refresh(); // TODO call api instead of refresh
character = characters.value.find(c => c.characterId === characterId);
}
return character;
}
const refresh = () => characterControllerApi.getCharacters().then(response => characters.value = response.data);