How to use the ngx-resource-factory/resource/resource-action-http-method.ResourceActionHttpMethod.POST function in ngx-resource-factory

To help you get started, we’ve selected a few ngx-resource-factory examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nezhar / snypy-frontend / src / app / services / resources / auth.resource.ts View on Github external
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) {
github nezhar / snypy-frontend / src / app / services / resources / auth.resource.ts View on Github external
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