Skip to content

Commit

Permalink
Merge pull request #5059 from kiva/teams_query_param_fix
Browse files Browse the repository at this point in the history
fix: change query param on new teams page
  • Loading branch information
eddieferrer authored Nov 6, 2023
2 parents 4904d54 + a1a47ac commit 88f80e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/pages/LendingTeams/TeamLeaderboards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export default {
};
},
watch: {
'$route.query.teamCategory': {
handler(teamCategory) {
if (teamCategory !== '') {
this.teamCategory = teamCategory;
'$route.query.category': {
handler(category) {
if (category !== '') {
this.teamCategory = category;
this.getLeaderboards();
}
},
Expand Down
20 changes: 10 additions & 10 deletions src/pages/LendingTeams/TeamListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ const urlParamTransform = {
return page > 1 ? String(page) : undefined;
}
},
teamCategory: {
to({ teamCategory }) {
return teamCategory;
category: {
to({ category }) {
return category;
}
},
teamOption: {
Expand Down Expand Up @@ -352,7 +352,7 @@ export default {
urlParams() {
return toUrlParams({
offset: this.offset,
...(this.teamCategory !== '' && { teamCategory: this.teamCategory }),
...(this.teamCategory !== '' && { category: this.teamCategory }),
...(this.teamOption !== '' && { teamOption: this.teamOption }),
teamSort: this.teamSort,
queryString: this.queryString,
Expand Down Expand Up @@ -395,13 +395,13 @@ export default {
pushToRouter('page');
return;
}
if (this.teamCategory && this.teamCategory !== this.$route.query?.teamCategory) {
pushToRouter('teamCategory');
if (this.teamCategory && this.teamCategory !== this.$route.query?.category) {
pushToRouter('category');
return;
}
if (this.teamCategory === '' && this.teamCategory !== this.$route.query?.teamCategory) {
if (this.teamCategory === '' && this.teamCategory !== this.$route.query?.category) {
const query = { ...this.$route.query };
delete query?.teamCategory;
delete query?.category;
this.$router.replace({ query });
}
if (this.teamOption && this.teamOption !== this.$route.query?.teamOption) {
Expand All @@ -410,7 +410,7 @@ export default {
}
if (this.teamOption === '' && this.teamOption !== this.$route.query?.teamOption) {
const query = { ...this.$route.query };
delete query?.teamCategory;
delete query?.teamOption;
this.$router.replace({ query });
}
if (this.queryString && this.queryString !== this.$route.query?.queryString) {
Expand All @@ -423,7 +423,7 @@ export default {
},
updateFromParams(query) {
this.offset = getPageOffset(query, this.limit);
this.teamCategory = query.teamCategory ?? '';
this.teamCategory = query.category ?? '';
this.teamOption = query.teamOption ?? '';
this.teamSort = query.teamSort ?? 'overallLoanedAmount';
this.queryString = query.queryString ?? '';
Expand Down

0 comments on commit 88f80e5

Please sign in to comment.