fix: navigation bugs

This commit is contained in:
swve 2023-01-29 19:28:48 +01:00
parent 898928759d
commit aeebcf1d63
4 changed files with 22 additions and 7 deletions

View file

@ -5,11 +5,17 @@ export const getAPIUrl = () => LEARNHOUSE_API_URL;
export const getBackendUrl = () => LEARNHOUSE_BACKEND_URL;
export const getUriWithOrg = ( orgslug: string, path: string) => {
export const getUriWithOrg = (orgslug: string, path: string) => {
return `http://localhost:3000/org/${orgslug}${path}`;
};
export const getOrgFromUri = (uri: any) => {
let org = uri.match(/\/org\/([\w]+)/)[1];
return org;
// if url contains /org
if (uri.includes("/org/")) {
let org = uri.match(/\/org\/([\w]+)/)[1];
return org;
}
else {
return "";
}
};