feat: UrlService um Routen- und URL-Methoden erweitert, die environments verwenden
This commit is contained in:
parent
3a3df2e7f1
commit
4d350bf6e8
@ -1,6 +1,7 @@
|
||||
import { Injectable, Inject, inject } from '@angular/core';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import { Meta } from '@angular/platform-browser';
|
||||
import { env } from '../../environments/environment';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@ -19,8 +20,22 @@ export class UrlService {
|
||||
return baseElement?.getAttribute('href') || '/';
|
||||
}
|
||||
|
||||
getApiUrl(): string | null {
|
||||
const apiMetaTag = this.meta.getTag('name="api-url"');
|
||||
return apiMetaTag ? apiMetaTag.content : null;
|
||||
getApiUrl(route: string = ""): string | null {
|
||||
return env.api_url + route;
|
||||
}
|
||||
|
||||
readonly apiRoute = {
|
||||
user: this.getApiUrl(env.routes.user),
|
||||
group: this.getApiUrl(env.routes.group),
|
||||
module: this.getApiUrl(env.routes.module),
|
||||
moduleOfUser: this.getApiUrl(env.routes.moduleOfUser),
|
||||
groupOfUser: this.getApiUrl(env.routes.groupOfUser),
|
||||
userRep: this.getApiUrl(env.routes.userRep),
|
||||
dirGroup: this.getApiUrl(env.routes.dirGroup),
|
||||
dirUser: this.getApiUrl(env.routes.dirUser),
|
||||
directory: this.getApiUrl(env.routes.directory),
|
||||
login: this.getApiUrl(env.routes.login),
|
||||
logout: this.getApiUrl(env.routes.logout),
|
||||
loginCheck: this.getApiUrl(env.routes.loginCheck)
|
||||
};
|
||||
}
|
||||
@ -1,16 +1,18 @@
|
||||
export const env = {
|
||||
production: false,
|
||||
api_url: "/api",
|
||||
user_route: "/user",
|
||||
group_route: "/group",
|
||||
module_route: "/module",
|
||||
module_of_user_route: "/moduleOfUser",
|
||||
group_of_user_route: "/groupOfUser",
|
||||
user_representation_route: "/userRep",
|
||||
dir_group_route: "/directory/Group?propName=samaccountname",
|
||||
dir_user_route: "/directory/user",
|
||||
dir_route: "/directory",
|
||||
login_route: "/auth/login",
|
||||
logout_route: "/auth/logout",
|
||||
login_check_route: "/auth/check"
|
||||
routes: {
|
||||
user: "/user",
|
||||
group: "/group",
|
||||
module: "/module",
|
||||
moduleOfUser: "/moduleOfUser",
|
||||
groupOfUser: "/groupOfUser",
|
||||
userRep: "/userRep",
|
||||
dirGroup: "/directory/Group?propName=samaccountname",
|
||||
dirUser: "/directory/user",
|
||||
directory: "/directory",
|
||||
login: "/auth/login",
|
||||
logout: "/auth/logout",
|
||||
loginCheck: "/auth/check"
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user