Skip to content

Commit

Permalink
fix gallery redirect removing query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Jul 31, 2024
1 parent 58a343e commit 2ab4e44
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pages/gallery/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
:packToName="packToName"
:ignoreList="ignoreList"
@share="copyShareURL"
@close="removeShareURL"
@close="closeModal"
/>

<v-btn icon large @click="toTop" v-show="scrollY > 300" class="go-up-btn">
Expand Down Expand Up @@ -148,7 +148,7 @@ export default {
// result
textures: [],
// loaded contributors
loadedContributors: {},
authors: {},
// modal opened ID
modalTextureID: null,
// modal texture opened
Expand Down Expand Up @@ -187,9 +187,6 @@ export default {
if (id !== undefined) changedURL += `?show=${id}`;
return changedURL;
},
removeShareURL() {
this.$router.push({ query: null });
},
copyShareURL(id) {
const url = this.newShareURL(id, false);
navigator.clipboard.writeText(url);
Expand All @@ -208,11 +205,13 @@ export default {
this.modalTextureObj = res.data;
});
},
closeModal() {
this.modalTextureID = null;
this.modalTextureObj = {};
this.$router.push({ query: null });
},
discordIDtoName(d) {
return (
this.loadedContributors[d]?.username ||
this.$root.lang().gallery.error_message.user_anonymous
);
return this.authors[d]?.username || this.$root.lang().gallery.error_message.user_anonymous;
},
startSearch() {
this.updateRoute();
Expand All @@ -226,6 +225,7 @@ export default {
updateRoute() {
let route = `/gallery/${this.current.edition}/${this.current.pack}/${this.current.version}/${this.current.tag}`;
if (this.current.search) route += `/${this.current.search.replace(/ /g, "_")}`;
if (this.modalTextureID !== null) route += `?show=${this.modalTextureID}`;
if (this.$route.path === route) return; // new search is the same as before
this.$router.push(route);
Expand Down Expand Up @@ -359,7 +359,7 @@ export default {
}, {});
});
axios.get(`${this.$root.apiURL}/contributions/authors`).then((res) => {
this.loadedContributors = res.data.reduce((acc, cur) => {
this.authors = res.data.reduce((acc, cur) => {
acc[cur.id] = cur;
return acc;
}, {});
Expand Down

0 comments on commit 2ab4e44

Please sign in to comment.