mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-04 21:58:54 -05:00
various fixes and improvements
This commit is contained in:
@@ -8,11 +8,15 @@ export function useDjangoUrls() {
|
||||
/**
|
||||
* given a path return the full server url to that url respecting possible sub path setups
|
||||
* @param path
|
||||
* @param appendSlash automatically append a slash to the end of the url (default true)
|
||||
*/
|
||||
function getDjangoUrl(path: string){
|
||||
if(path.charAt(0) == '/'){
|
||||
function getDjangoUrl(path: string, appendSlash = true){
|
||||
if(path.startsWith('/')){
|
||||
path = path.substring(1)
|
||||
}
|
||||
if(!path.endsWith('/') && appendSlash){
|
||||
path = path + '/'
|
||||
}
|
||||
|
||||
return `${basePath}/${path}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user