async FormData$ passed to form from container. Form radio-group component using formcontrolname
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { first } from 'rxjs/operators'; | |
import { User } from '@/_models'; | |
import { UserService, AuthenticationService } from '@/_services'; | |
@Component({ templateUrl: 'home.component.html' }) | |
export class HomeComponent implements OnInit { | |
currentUser: User; | |
users = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
contains a standard set of CRUD methods for managing users, | |
*/ | |
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { User } from '@/_models'; | |
@Injectable({ providedIn: 'root' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
posts the users credentials to the api and checks the response for a JWT token, if there is one it means authentication was successful so the user details including the token are added to local storage. | |
The currentUser observable can be used when you want a component to reactively update when a user logs in or out | |
The currentUserValue property can be used when you just want to get the current value of the logged in user,checking if the user is currently logged in. | |
https://jasonwatmore.com/post/2019/06/10/angular-8-user-registration-and-login-example-tutorial | |
*/ | |
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { BehaviorSubject, Observable } from 'rxjs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The alert service enables any component in the application to display alert messages at the top of the page via the alert component. | |
It has methods for displaying success and error messages, and a getMessage() method that returns an Observable that is used by the alert component to subscribe to notifications for whenever a message should be displayed. | |
https://jasonwatmore.com/post/2019/06/10/angular-8-user-registration-and-login-example-tutorial | |
*/ | |
import { Injectable } from '@angular/core'; | |
import { Router, NavigationStart } from '@angular/router'; | |
import { Observable, Subject } from 'rxjs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
import { AuthenticationService } from '@/_services'; | |
@Injectable() | |
export class JwtInterceptor implements HttpInterceptor { | |
constructor(private authenticationService: AuthenticationService) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The Error Interceptor intercepts http responses from the api to check if there were any errors. | |
If there is a 401 Unauthorized response the user is automatically logged out of the application, all other errors are re-thrown up to the calling service so an alert can be displayed to the user. | |
*/ | |
import { Injectable } from '@angular/core'; | |
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http'; | |
import { Observable, throwError } from 'rxjs'; | |
import { catchError } from 'rxjs/operators'; |
By extending the HttpInterceptor class you can create a custom interceptor to modify http requests before they get sent to the server. In this case the FakeBackendInterceptor intercepts certain requests based on their URL and provides a fake response instead of going to the server. ref: https://jasonwatmore.com/post/2019/06/10/angular-8-user-registration-and-login-example-tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use tap multiple times to debug values at different stages | |
of(1, 2, 3, 4).pipe( | |
tap(el => console.log(el)), | |
filter(n => n % 2 === 0), | |
tap(el => console.log(el)), | |
map(n => n + 10), | |
tap(el => console.log(el)), | |
scan((sum, n) => sum + n), | |
tap(el => console.log(el)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Build Roles | |
*/ | |
let _ = require('lodash'); | |
let transferTable = require('./transferTables_Util').transferTableFromStagingToProd; | |
// let tables = ['roles', 'permissions', 'role_permissions', 'nurture_triggers', 'nurture_chains', 'nurture_trigger_rules', | |
// 'account_api_keys', 'account_user_group_users', 'account_user_groups', 'account_users', 'users', |
NewerOlder