Error for token

Hi all.

I need your help. I am only in the process of studying. But I already got an error that I just can’t figure it out, if not difficult, tell me please

app.module.ts
providers: [
    StatusBar,
    SplashScreen,
      { provide: RouteReuseStrategy,
        useClass: IonicRouteStrategy,
        multi: true,
      },
    {
      provide: HTTP_INTERCEPTORS,
      multi: true,
      useClass: TokenInterceptor
    }
              ],

Token.Interceptor.ts

@Injectable()
export class TokenInterceptor implements HttpInterceptor{
    constructor(private auth:AuthService, private  router:Router){


   }
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
      if(this.auth.isAuthenticated()){
        req = req.clone({
          setHeaders:{
            Authorization:this.auth.getToken()
          }
        })
      }
      return next.handle(req).pipe(
      catchError(
        (error: HttpErrorResponse) => this.hadleAuthError(error)
      )
      )
}
private hadleAuthError(error:HttpErrorResponse): Observable<any> {
if (error.status === 401 ){
this.router.navigate(['/login'], {
queryParams:{
sessionFiled: true
}
})
}
return throwError(error)

}
}

ionic-route-reus-stategy.d.ts
import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router';
export declare class IonicRouteStrategy implements RouteReuseStrategy {
    shouldDetach(_route: ActivatedRouteSnapshot): boolean;
    shouldAttach(_route: ActivatedRouteSnapshot): boolean;
    store(_route: ActivatedRouteSnapshot, _detachedTree: DetachedRouteHandle): void;
    retrieve(_route: ActivatedRouteSnapshot): DetachedRouteHandle | null;
    shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean;
}


core.js:9110 ERROR Error: Uncaught (in promise): TypeError: routeReuseStrategy.shouldReuseRoute is not a function
TypeError: routeReuseStrategy.shouldReuseRoute is not a function
at createNode (router.js:2349)
at createRouterState (router.js:2338)
at MapSubscriber.project (router.js:5859)
at MapSubscriber._next (map.js:29)
at MapSubscriber.next (Subscriber.js:49)
at SwitchMapSubscriber.notifyNext (switchMap.js:67)
at InnerSubscriber._next (InnerSubscriber.js:11)
at InnerSubscriber.next (Subscriber.js:49)
at MapSubscriber._next (map.js:35)
at MapSubscriber.next (Subscriber.js:49)
at resolvePromise (zone-evergreen.js:797)
at resolvePromise (zone-evergreen.js:754)
at zone-evergreen.js:858
at ZoneDelegate.invokeTask (zone-evergreen.js:391)
at Object.onInvokeTask (core.js:34182)
at ZoneDelegate.invokeTask (zone-evergreen.js:390)
at Zone.runTask (zone-evergreen.js:168)
at drainMicroTaskQueue (zone-evergreen.js:559)

Why is the bold part there?

Without a multi, this error turns out and I thought it was worth adding

Uncaught Error: Provider parse errors:
Mixing multi and non multi provider is not possible for token InjectionToken_HTTP_INTERCEPTORS ("[ERROR ->]"): in NgModule AppModule in ./AppModule@-1:-1
    at NgModuleProviderAnalyzer.parse (compiler.js:10477)
    at NgModuleCompiler.compile (compiler.js:20607)
    at JitCompiler._compileModule (compiler.js:25606)
    at compiler.js:25567
    at Object.then (compiler.js:2166)
    at JitCompiler._compileModuleAndComponents (compiler.js:25565)
    at JitCompiler.compileModuleAsync (compiler.js:25527)
    at CompilerImpl.compileModuleAsync (platform-browser-dynamic.js:216)
    at compileNgModuleFactory__PRE_R3__ (core.js:34647)
    at PlatformRef.bootstrapModule (core.js:34956)

That’s specifically talking about HttpInterceptors, not RouteReuseStrategy. multi on providers isn’t the cleanest concept in the world IMHO, but basically providers need to know whether they’re part of a team or not, and all of them attempting to provide the same token (or class object) need to be on the same page about that - that’s what the error is telling you. HttpInterceptors want to be part of a team, RouteReuseStrategy does not.

Take it out. It’s the proximate cause of the error in your OP.

I deleted the multi, but I have not yet come up with the idea of ​​how to do everything.

“How to do everything” is a pretty tough ask. You posted a specific question about a specific error. Did said error not go away after you took off that “multi”?