Skip to content

Commit

Permalink
fix(FavoriteButton): pass tool path to favorite button (CorentinTh#1368)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitmotion authored Oct 25, 2024
1 parent c7b80fb commit ae13639
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/layouts/tool.layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const toolDescription = computed<string>(() => t(`tools.${i18nKey.value}.descrip
</n-h1>

<div>
<FavoriteButton :tool="{ name: route.meta.name } as Tool" />
<FavoriteButton :tool="{ name: route.meta.name, path: route.path } as Tool" />
</div>
</div>

Expand Down
5 changes: 4 additions & 1 deletion src/tools/tools.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export const useToolStore = defineStore('tools', () => {
newTools: computed(() => tools.value.filter(({ isNew }) => isNew)),

addToolToFavorites({ tool }: { tool: MaybeRef<Tool> }) {
favoriteToolsName.value.push(get(tool).path);
const toolPath = get(tool).path;
if (toolPath) {
favoriteToolsName.value.push(toolPath);
}
},

removeToolFromFavorites({ tool }: { tool: MaybeRef<Tool> }) {
Expand Down

0 comments on commit ae13639

Please sign in to comment.