Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/TandoorRecipes/recipes i…
Browse files Browse the repository at this point in the history
…nto develop
  • Loading branch information
vabene1111 committed Jul 8, 2024
2 parents 0ac3c55 + a289fd4 commit 45106ae
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions vue/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,22 @@ export const ResolveUrlMixin = {
}

export function resolveDjangoUrl(url, params = null) {
let fun = window.Urls[url];
if (typeof fun !== 'function') {
console.error(`window.Urls[${url}] is not a function: ${fun}`);
return
}
if (params == null) {
return window.Urls[url]()
return fun()
} else if (typeof params != "object") {
return window.Urls[url](params)
return fun(params)
} else if (typeof params == "object") {
if (params.length === 1) {
return window.Urls[url](params)
return fun(params)
} else if (params.length === 2) {
return window.Urls[url](params[0], params[1])
return fun(params[0], params[1])
} else if (params.length === 3) {
return window.Urls[url](params[0], params[1], params[2])
return fun(params[0], params[1], params[2])
}
}
}
Expand Down Expand Up @@ -774,4 +779,4 @@ export const formFunctions = {
}
return form
},
}
}

0 comments on commit 45106ae

Please sign in to comment.