improved file uploads
This commit is contained in:
@@ -2,3 +2,20 @@ export function getApiUrl(path: string): string {
|
||||
const API_BASE_URL = useRuntimeConfig().public.apiBase;
|
||||
return `${API_BASE_URL}/${path}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the warren's id in a warren path to its name
|
||||
* @param path - The warren path (e.g. `a3f79579-9155-4492-a579-b0253c8d3bf8/my-directory/`)
|
||||
* @returns A prettier path `a3f79579-9155-4492-a579-b0253c8d3bf8/my-directory` -> `my-warren/my-directory`
|
||||
*/
|
||||
export function routeWithWarrenName(path: string): string {
|
||||
const warrens = useWarrenStore().warrens;
|
||||
|
||||
const id = path.split('/')[0];
|
||||
|
||||
if (!(id in warrens)) {
|
||||
return path;
|
||||
}
|
||||
|
||||
return path.replace(id, warrens[id].name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user