hi where can i find logout logic to clear database for example i added an item to my table this item store in local storage i want when logout and login again with same user to clear this local storage so how can i did it ? i attached simple video to see what i want to do thank you
https://streamable.com/4l44ba
- ABP Framework version: v8.0.2
- UI Type: Angular
- Database System: EF Core (SQL Server)
8 Answer(s)
-
0
Hello ,
When the logout event is triggered, use JavaScript's
localStorage.clear()
method to remove all items from the local storage. Please try this once.Thank you.
-
0
hi i already know localStorage.clear() what i want is (where) to write it in abp angular ? where logout event is triggered ??
-
0
i'm using abp angular so it handles the login page automatically so how can i access logout event ?
-
0
Hello ,
Please try to this code in
app.component.ts
file. eg:-import { Component } from '@angular/core'; import { OAuthService } from 'angular-oauth2-oidc'; import { filter } from 'rxjs'; @Component({ selector: 'app-root', }) export class AppComponent { constructor(private oAuthService: OAuthService) { this.oAuthService.events .pipe(filter((event) => event?.type === 'logout')) .subscribe((event) => { // logout event fired localStorage.clear(); }); } }
When i click on logut button debugger was hit
Thank you,
-
0
-
0
i solved it thank you
-
0
Hello,
At my side its work there is nothing any issue check here.
You can refer this document https://abp.io/docs/8.2/tutorials/book-store/part-02?UI=NG&DB=EF if it is helpful for you.
Thank you.
-
0
i solved it thank you
Great : )