Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(registry: ResourceRegistry,
http: HttpClient,
private userResource: UserResource) {
super(registry, http);
}
@ResourceAction({
method: ResourceActionHttpMethod.POST,
isList: false,
invalidateCache: true,
urlSuffix: 'login/',
})
_login: ResourceActionMethod;
@ResourceAction({
method: ResourceActionHttpMethod.POST,
isList: false,
invalidateCache: true,
urlSuffix: 'logout/',
})
_logout: ResourceActionMethod;
/**
* This method is used in the main app component to load an active user during the bootstrap process
*/
public init() {
if (AuthResource.getToken()) {
this.loadCurrentUser();
}
}
public login(credentials: AuthCredentials) {
stripTrailingSlashes: false,
})
export class AuthResource extends Resource {
isLoggedId = false;
currentUser: ResourceModel = null;
loginStatusUpdates: Subject = new Subject();
constructor(registry: ResourceRegistry,
http: HttpClient,
private userResource: UserResource) {
super(registry, http);
}
@ResourceAction({
method: ResourceActionHttpMethod.POST,
isList: false,
invalidateCache: true,
urlSuffix: 'login/',
})
_login: ResourceActionMethod;
@ResourceAction({
method: ResourceActionHttpMethod.POST,
isList: false,
invalidateCache: true,
urlSuffix: 'logout/',
})
_logout: ResourceActionMethod;
/**
* This method is used in the main app component to load an active user during the bootstrap process