Skip to content

Commit

Permalink
feat: create id for searched tags
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jul 30, 2021
1 parent 20e5f2e commit a995d8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/pages/posts/navigation/search/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<!-- Add tag to array of added tags -->
<button
v-for="tag in search.data"
:key="tag.name"
:key="tag.id"
type="button"
class="tag link group"
@click="addTagConsideringBanMode(tag.name)"
Expand Down
5 changes: 4 additions & 1 deletion store/booru.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,11 @@ export const actions = {
}
},

async fetchTags({ dispatch, commit }, tag) {
async fetchTags({ getters, dispatch }, tag) {
const url = await dispatch('createApiUrl', { mode: 'tags', tag })

const ACTIVE_BOORU_DOMAIN = getters.getActiveBooru.domain

try {
const response = await dispatch(
'simpleFetch',
Expand All @@ -444,6 +446,7 @@ export const actions = {
// This is how a final Booru Tag object looks like
const TAGS = response.map((TAG) => {
return {
id: `${ACTIVE_BOORU_DOMAIN}-${TAG.name}`,
name: TAG.name,
count: TAG.count,
}
Expand Down

0 comments on commit a995d8e

Please sign in to comment.