list warrens + explore nested folders
This commit is contained in:
5
frontend/utils/api.ts
Normal file
5
frontend/utils/api.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export function getApiUrl(path: string): string {
|
||||
const API_BASE_URL = useRuntimeConfig().public.apiBase;
|
||||
console.log(API_BASE_URL);
|
||||
return `${API_BASE_URL}/${path}`;
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { BreadcrumbData } from '~/types';
|
||||
|
||||
export function getBreadcrumbs(path: string): BreadcrumbData[] {
|
||||
const { warrens } = useWarrenStore();
|
||||
|
||||
const crumbs = path
|
||||
.split('/')
|
||||
.filter((v) => v.length > 0)
|
||||
@@ -21,6 +23,14 @@ export function getBreadcrumbs(path: string): BreadcrumbData[] {
|
||||
.join('/');
|
||||
}
|
||||
|
||||
if (
|
||||
crumbs.length >= 3 &&
|
||||
crumbs[1].href === '/warrens' &&
|
||||
crumbs[2].name in warrens
|
||||
) {
|
||||
crumbs[2].name = warrens[crumbs[2].name].name;
|
||||
}
|
||||
|
||||
return crumbs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user