Skip to content

Instantly share code, notes, and snippets.

@changhuixu
Created July 26, 2020 02:46
Show Gist options
  • Save changhuixu/56e3d49398d92772da4b03bdfd7c73b9 to your computer and use it in GitHub Desktop.
Save changhuixu/56e3d49398d92772da4b03bdfd7c73b9 to your computer and use it in GitHub Desktop.
export function appInitializer(authService: AuthService) {
return () =>
new Promise((resolve) => {
console.log('refresh token on app start up')
authService.refreshToken().subscribe().add(resolve);
});
}
@changhuixu
Copy link
Author

Hi @Krzysztofz01 , thank you for pointing it out.
I have updated the solution to Angular v13.
Please check my Git repo for details.

https://github.com/dotnet-labs/JwtAuthDemo/blob/51ef91c75bed8538c62700014c0ad828f63d486a/angular/src/app/core/services/app-initializer.ts#L4-L8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment