Skip to content

Commit

Permalink
refactor getDestinationUrl method
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Quelca committed Jun 6, 2024
1 parent 3faa7ad commit 3e17831
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/components/task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,25 @@ export default {
* @returns {string|null} - The destination URL.
*/
getDestinationUrl() {
// If the element destination is 'taskSource', use the document referrer
if (this.task?.elementDestination === "taskSource") {
return document.referrer;
// If the element destination type is 'taskSource', use the document referrer
if (this.task?.elementDestination?.type === "taskSource") {
return document.referrer || null;
}
// If element destination is not set, try to get it from sessionStorage
return (
this.task.elementDestination?.url ||
sessionStorage.getItem("elementDestinationURL") ||
null
);
// If element destination URL is available, return it
const elementDestinationUrl = this.task?.elementDestination?.value;
if (elementDestinationUrl) {
return elementDestinationUrl;
}
// If no element destination URL, try to get it from sessionStorage
const sessionStorageUrl = sessionStorage.getItem("elementDestinationURL");
if (sessionStorageUrl) {
return sessionStorageUrl;
}
// If none of the above conditions are met, return null
return null;
},
loadNextAssignedTask(requestId = null) {
if (!requestId) {
Expand Down

0 comments on commit 3e17831

Please sign in to comment.