These are chat archives for AngularClass/angular2-webpack-starter

1st
Nov 2017
texirv0203
@texirv0203
Nov 01 2017 00:28

@all hi,

  • I am trying to learn rxjs.
  • I am trying to add auth token validation through my front end for my githunb api.
  • can I achieve in js side or do I need to use express js to achieve it
  • I googled for for how to add auth validation.
  • but I am not sure how to add it to my code.
  • can you guys tell me how to achieve.
  • providing my code below

https://repl.it/N0E3/1

const getJsonPromise = $.getJSON('https://api.github.com/users');

Rx.Observable
  .fromPromise(getJsonPromise)
  .retryWhen(errors => {
    return errors.scan((errorCount, err) => {
      //auth token validation
    }, 0);
  })
  .subscribe(users => {
    console.log('users ready', users);
  });