Skip to content

Commit

Permalink
fix: done url after auth guard, done url not being empty string, team…
Browse files Browse the repository at this point in the history
… filter to url
  • Loading branch information
eddieferrer committed Oct 1, 2024
1 parent 1e3f891 commit 85109d0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/pages/LendingTeams/TeamListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export default {
this.pageQuery = { page: this.offset / this.limit };
this.pushChangesToUrl();
},
pushChangesToUrl() {
async pushChangesToUrl() {
const pushToRouter = variable => {
this.$router.push({
query: {
Expand All @@ -405,7 +405,7 @@ export default {
if (this.teamCategory === '' && this.teamCategory !== this.$route.query?.category) {
const query = { ...this.$route.query };
delete query?.category;
this.$router.replace({ query });
await this.$router.push({ query });
}
if (this.teamOption && this.teamOption !== this.$route.query?.teamOption) {
pushToRouter('teamOption');
Expand All @@ -414,7 +414,7 @@ export default {
if (this.teamOption === '' && this.teamOption !== this.$route.query?.teamOption) {
const query = { ...this.$route.query };
delete query?.teamOption;
this.$router.replace({ query });
await this.$router.push({ query });
}
if (this.queryString && this.queryString !== this.$route.query?.queryString) {
pushToRouter('queryString');
Expand Down
2 changes: 1 addition & 1 deletion src/pages/StartVerification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default {
this.apollo.mutate({
mutation: startEmailVerification,
variables: {
doneUrl: this.doneUrl || null,
doneUrl: this.doneUrl || '',
},
awaitRefetchQueries: true,
refetchQueries: [
Expand Down
9 changes: 5 additions & 4 deletions src/util/authenticationGuard.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ export function checkLastLoginTime(data, durationKey, defaultDuration) {
}

const processErrors = (error, route) => {
const doneUrl = route?.value?.fullPath || route?.fullPath || '';
if (error.message.indexOf('activeLoginRequired') > -1 || error.message.indexOf('recentLoginRequired') > -1) {
// Force a login when active/recent login is required
return {
path: '/ui-login',
query: { force: true, doneUrl: route.fullPath }
query: { force: true, doneUrl }
};
}

if (error.message.indexOf('api.authenticationRequired') > -1) {
// Redirect to login upon authentication error
return {
path: '/ui-login',
query: { doneUrl: route.fullPath }
query: { doneUrl }
};
}

Expand All @@ -38,7 +39,7 @@ const processErrors = (error, route) => {
return {
path: '/start-verification',
query: {
doneUrl: route.fullPath,
doneUrl,
process: lastMatchedRoute.meta.process || '',
}
};
Expand All @@ -54,7 +55,7 @@ const processErrors = (error, route) => {
// catch all redirect to login
return {
path: '/ui-login',
query: { doneUrl: route.fullPath }
query: { doneUrl }
};
};

Expand Down

0 comments on commit 85109d0

Please sign in to comment.