Skip to content

Commit

Permalink
Merge pull request #754 from DiamondLightSource/fix/lims-1288/pato-re…
Browse files Browse the repository at this point in the history
…direct-url

[LIMS-1288] SynchWeb link to PATo with undefined session
  • Loading branch information
gfrn authored Apr 15, 2024
2 parents f58b3df + c1eee45 commit 362848f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions client/src/js/modules/types/em/dc/redirect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,25 @@ export default {
},
'computed': {
redirectUrl: function () {
let redirectLocation = this.$store.state.appOptions.redirects.em;
const visitStr = this.collection.queryParams.visit;
const [proposal, visit] = visitStr.split("-");
return `${this.$store.state.appOptions.redirects.em}/proposals/${proposal}/sessions/${visit}`
if (visitStr) {
const [proposal, visit] = visitStr.split("-");
redirectLocation += `/proposals/${proposal}/sessions/${visit}`;
} else {
const pathParams = window.location.pathname.split("/");
const lastParam = pathParams.pop().split("-");
if(lastParam.length === 2) {
redirectLocation += `/proposals/${lastParam[0]}`
if(!isNaN(lastParam[1])) {
redirectLocation += `/sessions/${lastParam[1]}`;
}
}
}
return redirectLocation;
}
},
}
Expand Down

0 comments on commit 362848f

Please sign in to comment.