I have a application, where frontend written by Angular 6 and backend - by Django Rest Framework.
User logging out implemented on the frond with following code:
@Component({
selector: 'app-logout-modal',
templateUrl: './logout-modal.component.html',
styleUrls: ['./logout-modal.component.scss']
})
export class LogoutModalComponent implements OnInit {
constructor(public thisDialogRef: MatDialogRef<LogoutModalComponent>,
private router: Router,
@Inject(MAT_DIALOG_DATA) public data: any) {
}
ngOnInit() {
}
logoutAndClose(): void {
localStorage.clear();
this.thisDialogRef.close();
this.router.navigateByUrl(RouteUrls.Login);
}
}
class ProfileSettingsViewset(mixins.RetrieveModelMixin, mixins.UpdateModelMixin, viewsets.GenericViewSet):
@action(detail=False, methods=['post'])
def logout(self, request):
#???
return Response(status=status.HTTP_200_OK)
That is, the user is not actually logging out.
How can I implement user logout by session on the DRF?