Skip to content

Commit

Permalink
Fix star button on spaces directory (don't show when anonymous)
Browse files Browse the repository at this point in the history
Add callback to star button for reload favorites list
  • Loading branch information
AMEST committed Sep 22, 2024
1 parent 4b233b2 commit 9b66120
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
></b-avatar>
<b>{{ space.name }}</b>
</div>
<div class="space-actions">
<div class="space-actions" v-if="this.$store.state.application.profile">
<b-button variant="light" @click="star">
<b-icon-star-fill v-if="inFavorite" variant="warning" />
<b-icon-star v-else />
Expand All @@ -26,6 +26,7 @@ export default {
name: "SpaceListItem",
props: {
space: Object,
callBack: Function
},
data() {
return {
Expand All @@ -50,11 +51,15 @@ export default {
await FavoriteService.addSpace(this.space.key);
}
this.inFavorite = !this.inFavorite;
if (this.callBack)
this.callBack();
},
unStar: async function () {
var favorite = await FavoriteService.getSpace(this.space.key);
if (favorite == null) return;
await FavoriteService.delete(favorite.id);
if (this.callBack)
this.callBack();
},
},
created: async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
v-for="space in spaces"
:key="space.key"
:space="space"
:callBack="loadFavorites"
button
/>
</b-list-group>
Expand Down

0 comments on commit 9b66120

Please sign in to comment.