File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 /**
Original file line number Diff line number Diff 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} ;
You can’t perform that action at this time.
0 commit comments