Skip to content

Commit

Permalink
fix: opening Details
Browse files Browse the repository at this point in the history
  • Loading branch information
stritti committed Feb 14, 2024
1 parent e54c98e commit 73e2da8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/store/target.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const useTargetStore = defineStore("target", {
isLoading: false
}),
getters: {
getTargetList: (state) => state.targetList,
getTargetById: (state) => (id: string) => state.targetList.find((target) => target.id === id)
getTargetList: (state) => state.targetList as Array<Target>,
getTargetById: (state) => (id: string) => state.targetList.find((target) => target.id === id) as Target
},
actions: {
async getTargetRecords () {
Expand Down
10 changes: 7 additions & 3 deletions src/views/DetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import MaterialCallToActionButton from '@/components/material/MaterialCallToActi
import { mapState } from 'pinia'
import { useMaterialStore } from '@/store/material.store'
import { useTipStore } from '@/store/tip.store'
import { useTargetStore } from '@/store/target.store'
import type Tip from '@/types/tip'
import type Material from '@/types/material'
Expand Down Expand Up @@ -116,10 +117,10 @@ export default {
return this.material ? this.material.notes : 'Loading...'
},
share (): {title: string, text: string} {
if (this.material?.targets) {
if (this.material && this.material?.targets) {
return {
title: `Mülli: ${this.material.name} entsorgen 👉 ${this.getMaterialById(this.material.targets[0]).name}`,
text: `${this.material.name} entsorgen: ${this.getMaterialById(this.material.targets[0]).name}
title: `Mülli: ${this.material.name} entsorgen 👉 ${this.getTargetById(this.material.targets[0]).name}`,
text: `${this.material.name} entsorgen: ${this.getTargetById(this.material.targets[0]).name}
${this.material?.notes}`
}
} else {
Expand All @@ -134,6 +135,9 @@ export default {
}),
...mapState( useMaterialStore, {
getMaterialById: store => store.getMaterialById
}),
...mapState(useTargetStore, {
getTargetById: store => store.getTargetById
})
},
created () {
Expand Down

0 comments on commit 73e2da8

Please sign in to comment.