New eveal #32
@@ -1,4 +1,4 @@
|
|||||||
import {activityApi, characterApi} from "@/mammon";
|
import {characterApi} from "@/mammon";
|
||||||
import {defineStore} from "pinia";
|
import {defineStore} from "pinia";
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
import {CharacterResponse} from "@/generated/mammon";
|
import {CharacterResponse} from "@/generated/mammon";
|
||||||
@@ -18,11 +18,9 @@ export const useCharactersStore = defineStore('characters', () => {
|
|||||||
return character;
|
return character;
|
||||||
}
|
}
|
||||||
|
|
||||||
const reloadActivities = (characterId: number): Promise<void> => activityApi.fetchNewActivitiesForCharacter(characterId) as Promise<void>;
|
|
||||||
|
|
||||||
const refresh = () => characterApi.findAllCharacters().then(response => characters.value = response.data);
|
const refresh = () => characterApi.findAllCharacters().then(response => characters.value = response.data);
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
return {characters, findById, reloadActivities};
|
return {characters, findById};
|
||||||
})
|
})
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import {CharacterLabel, useCharactersStore} from "@/characters";
|
import {CharacterLabel, useCharactersStore} from "@/characters";
|
||||||
import {useAuthStore} from "@/auth";
|
import {useAuthStore} from "@/auth";
|
||||||
import {ArrowPathIcon} from '@heroicons/vue/24/outline';
|
|
||||||
|
|
||||||
const charactersStore = useCharactersStore()
|
const charactersStore = useCharactersStore()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
@@ -17,7 +16,6 @@ const addCharacter = () => authStore.addCharacter();
|
|||||||
</div>
|
</div>
|
||||||
<div v-for="character in charactersStore.characters" :key="character.characterId" class="flex items-center mb-2">
|
<div v-for="character in charactersStore.characters" :key="character.characterId" class="flex items-center mb-2">
|
||||||
<CharacterLabel class="grow" :character="character" />
|
<CharacterLabel class="grow" :character="character" />
|
||||||
<button class="btn-icon" @click="charactersStore.reloadActivities(character.characterId)"><ArrowPathIcon /></button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
Reference in New Issue
Block a user