fix base href fn token
This commit is contained in:
parent
c651a6d863
commit
884df60cb8
@ -56,12 +56,12 @@ export abstract class BaseUserPreferenceService extends GenericService<UserAttri
|
|||||||
return this._put(body, `${this._defaultModelPath}/${key}`);
|
return this._put(body, `${this._defaultModelPath}/${key}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _save(key: string, value: string): Promise<void> {
|
protected async _save(key: string, value: string): Promise<void> {
|
||||||
this.userAttributes[key] = [value];
|
this.userAttributes[key] = [value];
|
||||||
await firstValueFrom(this.savePreferences([value], key));
|
await firstValueFrom(this.savePreferences([value], key));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getAttribute(key: string, defaultValue = ''): string {
|
protected _getAttribute(key: string, defaultValue = ''): string {
|
||||||
if (this.userAttributes[key]?.length > 0) {
|
if (this.userAttributes[key]?.length > 0) {
|
||||||
return this.userAttributes[key][0];
|
return this.userAttributes[key][0];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,16 +19,15 @@ export const BASE_HREF = new InjectionToken<string>('BASE_HREF', {
|
|||||||
export type BaseHrefFn = (path: string) => string;
|
export type BaseHrefFn = (path: string) => string;
|
||||||
|
|
||||||
export const BASE_HREF_FN = new InjectionToken<BaseHrefFn>('Convert path function', {
|
export const BASE_HREF_FN = new InjectionToken<BaseHrefFn>('Convert path function', {
|
||||||
factory: () => (path: string) => {
|
factory: () => {
|
||||||
const baseUrl = inject(BASE_HREF);
|
const baseUrl = inject(BASE_HREF);
|
||||||
if (!baseUrl) {
|
|
||||||
throw new Error('BASE_HREF is not defined');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path[0] === '/') {
|
return (path: string) => {
|
||||||
return baseUrl + path;
|
if (path[0] === '/') {
|
||||||
}
|
return baseUrl + path;
|
||||||
|
}
|
||||||
|
|
||||||
return baseUrl + '/' + path;
|
return baseUrl + '/' + path;
|
||||||
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user