Skip to content

Commit ae13639

Browse files
authored
fix(FavoriteButton): pass tool path to favorite button (CorentinTh#1368)
1 parent c7b80fb commit ae13639

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/layouts/tool.layout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const toolDescription = computed<string>(() => t(`tools.${i18nKey.value}.descrip
4040
</n-h1>
4141

4242
<div>
43-
<FavoriteButton :tool="{ name: route.meta.name } as Tool" />
43+
<FavoriteButton :tool="{ name: route.meta.name, path: route.path } as Tool" />
4444
</div>
4545
</div>
4646

src/tools/tools.store.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ export const useToolStore = defineStore('tools', () => {
4545
newTools: computed(() => tools.value.filter(({ isNew }) => isNew)),
4646

4747
addToolToFavorites({ tool }: { tool: MaybeRef<Tool> }) {
48-
favoriteToolsName.value.push(get(tool).path);
48+
const toolPath = get(tool).path;
49+
if (toolPath) {
50+
favoriteToolsName.value.push(toolPath);
51+
}
4952
},
5053

5154
removeToolFromFavorites({ tool }: { tool: MaybeRef<Tool> }) {

0 commit comments

Comments
 (0)