Skip to content

Commit a926767

Browse files
author
Andrea Barbasso
committed
Merged dspace-cris-2023_02_x into task/dspace-cris-2023_02_x/DSC-1852
2 parents fb11f0c + f37dc08 commit a926767

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/app/core/locale/locale.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class LocaleService {
5353
this.routeService.getQueryParameterValue('lang').subscribe(lang => {
5454
if (lang && this.translate.getLangs().includes(lang)) {
5555
this.setCurrentLanguageCode(lang);
56+
this.routeService.removeQueryParam('lang');
5657
}
5758
});
5859
}

src/app/core/services/route.service.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,23 @@ export class RouteService {
225225
}
226226
);
227227
}
228+
229+
/**
230+
* Remove a parameter from the current route
231+
* @param key The parameter name
232+
*/
233+
removeQueryParam(key: string) {
234+
let queryParams = { ...this.route.snapshot.queryParams };
235+
delete queryParams[key];
236+
237+
// Navigate to the same route with the updated queryParams
238+
this.router.navigate(
239+
[],
240+
{
241+
relativeTo: this.route,
242+
queryParams: queryParams,
243+
}
244+
);
245+
246+
}
228247
}

src/app/shared/cookies/browser-klaro.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export class BrowserKlaroService extends KlaroService {
264264
* Show the cookie consent form
265265
*/
266266
showSettings() {
267-
this.lazyKlaro.then(({show}) => show(this.klaroConfig));
267+
void this.lazyKlaro.then(({show}) => show(this.klaroConfig, true));
268268
}
269269

270270
/**

src/app/shared/testing/route-service.stub.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export const routeServiceStub: any = {
3737
},
3838
getPreviousUrl: () => {
3939
return observableOf('/home');
40+
},
41+
removeQueryParam: () => {
42+
return;
4043
}
4144
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
4245
};

0 commit comments

Comments
 (0)