text: (window["webpackJsonp"] = window["webpackJsonp"] || []).push([["main"],{
  
  /***/ "./$$_lazy_route_resource lazy recursive":
  /*!******************************************************!*\
    !*** ./$$_lazy_route_resource lazy namespace object ***!
    \******************************************************/
  /*! no static exports found */
  /***/ (function(module, exports) {
  
  function webpackEmptyAsyncContext(req) {
  	// Here Promise.resolve().then() is used instead of new Promise() to prevent
  	// uncaught exception popping up in devtools
  	return Promise.resolve().then(function() {
  		var e = new Error("Cannot find module '" + req + "'");
  		e.code = 'MODULE_NOT_FOUND';
  		throw e;
  	});
  }
  webpackEmptyAsyncContext.keys = function() { return []; };
  webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;
  module.exports = webpackEmptyAsyncContext;
  webpackEmptyAsyncContext.id = "./$$_lazy_route_resource lazy recursive";
  
  /***/ }),
  
  /***/ "./node_modules/raw-loader/index.js!./src/app/admin/admin.component.html":
  /*!**********************************************************************!*\
    !*** ./node_modules/raw-loader!./src/app/admin/admin.component.html ***!
    \**********************************************************************/
  /*! no static exports found */
  /***/ (function(module, exports) {
  
  module.exports = "<div class=\"card mt-4\">\n    <h4 class=\"card-header\">Admin</h4>\n    <div class=\"card-body\">\n        <p>This page can be accessed <u>only by administrators</u>.</p>\n        <p class=\"mb-1\">All users from secure (admin only) api end point:</p>\n        <div *ngIf=\"loading\" class=\"spinner-border spinner-border-sm\"></div>\n        <ul *ngIf=\"users\">\n            <li *ngFor=\"let user of users\">{{user.firstName}} {{user.lastName}}</li>\n        </ul>\n    </div>\n</div>"
  
  /***/ }),
  
  /***/ "./node_modules/raw-loader/index.js!./src/app/app.component.html":
  /*!**************************************************************!*\
    !*** ./node_modules/raw-loader!./src/app/app.component.html ***!
    \**************************************************************/
  /*! no static exports found */
  /***/ (function(module, exports) {
  
  module.exports = "<!-- nav -->\n<nav class=\"navbar navbar-expand navbar-dark bg-dark\" *ngIf=\"currentUser\">\n    <div class=\"navbar-nav\">\n        <a class=\"nav-item nav-link\" routerLink=\"/\">Home</a>\n        <a class=\"nav-item nav-link\" routerLink=\"/admin\" *ngIf=\"isAdmin\">Admin</a>\n        <a class=\"nav-item nav-link\" (click)=\"logout()\">Logout</a>\n    </div>\n</nav>\n\n<!-- main app container -->\n<div class=\"container\">\n    <router-outlet></router-outlet>\n</div>\n\n<!-- credits -->\n<div class=\"text-center mt-4\">\n</div>"
  
  /***/ }),
  
  /***/ "./node_modules/raw-loader/index.js!./src/app/home/home.component.html":
  /*!********************************************************************!*\
    !*** ./node_modules/raw-loader!./src/app/home/home.component.html ***!
    \********************************************************************/
  /*! no static exports found */
  /***/ (function(module, exports) {
  
  module.exports = "<div class=\"card mt-4\">\n    <h4 class=\"card-header\">Home</h4>\n    <div class=\"card-body\">\n        <p>You're logged in with Angular 8 & JWT!!</p>\n        <p>Your role is: <strong>{{currentUser.role}}</strong>.</p>\n        <p>This page can be accessed by <u>all authenticated users</u>.</p>\n        <p class=\"mb-1\">Current user from secure api end point:</p>\n        <div *ngIf=\"loading\" class=\"spinner-border spinner-border-sm\"></div>\n        <ul *ngIf=\"userFromApi\">\n            <li>{{userFromApi.firstName}} {{userFromApi.lastName}}</li>\n        </ul>\n    </div>\n</div>"
  
  /***/ }),
  
  /***/ "./node_modules/raw-loader/index.js!./src/app/login/login.component.html":
  /*!**********************************************************************!*\
    !*** ./node_modules/raw-loader!./src/app/login/login.component.html ***!
    \**********************************************************************/
  /*! no static exports found */
  /***/ (function(module, exports) {
  
  module.exports = "<div class=\"col-md-6 offset-md-3 mt-5\">\n    <div class=\"alert alert-info\">\n        <strong>Normal User</strong> - U: user P: user<br />\n        <strong>Administrator</strong> - U: admin P: admin\n    </div>\n    <div class=\"card\">\n        <div class=\"text-center mt-4\">\n            <h4 class=\"card-header\">Login Form</h4>\n        </div>\n        <div class=\"card-body\">\n            <form [formGroup]=\"loginForm\" (ngSubmit)=\"onSubmit()\">\n                <div class=\"form-group\">\n                    <label for=\"user_email\">Email</label>\n                    <input type=\"text\" formControlName=\"user_email\" class=\"form-control\" [ngClass]=\"{ 'is-invalid': submitted && f.user_email.errors }\" />\n                    <div *ngIf=\"submitted && f.user_email.errors\" class=\"invalid-feedback\">\n                        <div *ngIf=\"f.user_email.errors.required\">Email is required</div>\n                        <div *ngIf=\"f.user_email.errors.email\">Email must be a valid email address</div>\n                    </div>\n                </div>\n                <div class=\"form-group\">\n                    <label for=\"password\">Password</label>\n                    <input type=\"password\" formControlName=\"password\" class=\"form-control\" [ngClass]=\"{ 'is-invalid': submitted && f.password.errors }\" />\n                    <div *ngIf=\"submitted && f.password.errors\" class=\"invalid-feedback\">\n                        <div *ngIf=\"f.password.errors.required\">Password is required</div>\n                    </div>\n                </div>\n                <button [disabled]=\"loading\" class=\"btn btn-primary\">\n                    <span *ngIf=\"loading\" class=\"spinner-border spinner-border-sm mr-1\"></span>\n                    Login\n                </button>\n                <div *ngIf=\"error\" class=\"alert alert-danger mt-3 mb-0\">{{error}}</div>\n            </form>\n        </div>\n    </div>\n</div>            "
  
  /***/ }),
  
  /***/ "./node_modules/raw-loader/index.js!./src/app/register/register.component.html":
  /*!****************************************************************************!*\
    !*** ./node_modules/raw-loader!./src/app/register/register.component.html ***!
    \****************************************************************************/
  /*! no static exports found */
  /***/ (function(module, exports) {
  
  module.exports = "<div class=\"col-md-6 offset-md-3 mt-5\">\n    <!--div class=\"alert alert-info\">\n    </div-->\n    <div class=\"card\">\n        <div class=\"text-center mt-4\">\n            <h4 class=\"card-header\">Register Form</h4>\n        </div>\n        <div class=\"card-body\">\n            <form [formGroup]=\"registerForm\" (ngSubmit)=\"onSubmit()\">\n                <div class=\"form-group\">\n                    <label for=\"firstName\">First Name</label>\n                    <input type=\"text\" formControlName=\"firstName\" class=\"form-control\" [ngClass]=\"{ 'is-invalid': submitted && f.firstName.errors }\" />\n                    <div *ngIf=\"submitted && f.firstName.errors\" class=\"invalid-feedback\">\n                        <div *ngIf=\"f.firstName.errors.required\">First Name is required</div>\n                    </div>\n                </div>\n                <div class=\"form-group\">\n                    <label for=\"lastName\">Last Name</label>\n                    <input type=\"text\" formControlName=\"lastName\" class=\"form-control\" [ngClass]=\"{ 'is-invalid': submitted && f.lastName.errors }\" />\n                    <div *ngIf=\"submitted && f.lastName.errors\" class=\"invalid-feedback\">\n                        <div *ngIf=\"f.lastName.errors.required\">Last Name is required</div>\n                    </div>\n                </div>\n                <div class=\"form-group\">\n                    <label for=\"user_email\">Email</label>\n                    <input type=\"text\" formControlName=\"user_email\" class=\"form-control\" [ngClass]=\"{ 'is-invalid': submitted && f.user_email.errors }\" />\n                    <div *ngIf=\"submitted && f.user_email.errors\" class=\"invalid-feedback\">\n                        <div *ngIf=\"f.user_email.errors.required\">Email is required</div>\n                        <div *ngIf=\"f.user_email.errors.email\">Email must be a valid email address</div>\n                    </div>\n                </div>\n                <div class=\"form-group\">\n                    <label for=\"password\">Password</label>\n                    <input type=\"password\" formControlName=\"password\" class=\"form-control\" [ngClass]=\"{ 'is-invalid': submitted && f.password.errors }\" />\n                    <div *ngIf=\"submitted && f.password.errors\" class=\"invalid-feedback\">\n                        <div *ngIf=\"f.password.errors.required\">Password is required</div>\n                    </div>\n                </div>\n                <button [disabled]=\"loading\" class=\"btn btn-primary\">\n                    <span *ngIf=\"loading\" class=\"spinner-border spinner-border-sm mr-1\"></span>\n                    Register\n                </button>\n                <div *ngIf=\"error\" class=\"alert alert-danger mt-3 mb-0\">{{error}}</div>\n            </form>\n        </div>\n    </div>\n</div>            "
  
  /***/ }),
  
  /***/ "./src/app/_helpers/auth.guard.ts":
  /*!****************************************!*\
    !*** ./src/app/_helpers/auth.guard.ts ***!
    \****************************************/
  /*! exports provided: AuthGuard */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AuthGuard", function() { return AuthGuard; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  /* harmony import */ var _app_services__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @app/_services */ "./src/app/_services/index.ts");
  
  
  
  
  var AuthGuard = /** @class */ (function () {
      function AuthGuard(router, authenticationService) {
          this.router = router;
          this.authenticationService = authenticationService;
      }
      AuthGuard.prototype.canActivate = function (route, state) {
          var currentUser = this.authenticationService.currentUserValue;
          if (currentUser) {
              // check if route is restricted by role
              if (route.data.roles && route.data.roles.indexOf(currentUser.role) === -1) {
                  // role not authorised so redirect to home page
                  this.router.navigate(['/']);
                  return false;
              }
              // authorised so return true
              return true;
          }
          // not logged in so redirect to login page with the return url
          this.router.navigate(['/login'], { queryParams: { returnUrl: state.url } });
          return false;
      };
      AuthGuard.ctorParameters = function () { return [
          { type: _angular_router__WEBPACK_IMPORTED_MODULE_2__["Router"] },
          { type: _app_services__WEBPACK_IMPORTED_MODULE_3__["AuthenticationService"] }
      ]; };
      AuthGuard = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])({ providedIn: 'root' }),
          tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_angular_router__WEBPACK_IMPORTED_MODULE_2__["Router"],
              _app_services__WEBPACK_IMPORTED_MODULE_3__["AuthenticationService"]])
      ], AuthGuard);
      return AuthGuard;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/_helpers/error.interceptor.ts":
  /*!***********************************************!*\
    !*** ./src/app/_helpers/error.interceptor.ts ***!
    \***********************************************/
  /*! exports provided: ErrorInterceptor */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorInterceptor", function() { return ErrorInterceptor; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js");
  /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  /* harmony import */ var _app_services__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @app/_services */ "./src/app/_services/index.ts");
  
  
  
  
  
  var ErrorInterceptor = /** @class */ (function () {
      function ErrorInterceptor(authenticationService) {
          this.authenticationService = authenticationService;
      }
      ErrorInterceptor.prototype.intercept = function (request, next) {
          var _this = this;
          return next.handle(request).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])(function (err) {
              if ([401, 403].indexOf(err.status) !== -1) {
                  // auto logout if 401 Unauthorized or 403 Forbidden response returned from api
                  _this.authenticationService.logout();
                  location.reload(true);
              }
              var error = err.error.message || err.statusText;
              return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["throwError"])(error);
          }));
      };
      ErrorInterceptor.ctorParameters = function () { return [
          { type: _app_services__WEBPACK_IMPORTED_MODULE_4__["AuthenticationService"] }
      ]; };
      ErrorInterceptor = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
          tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_app_services__WEBPACK_IMPORTED_MODULE_4__["AuthenticationService"]])
      ], ErrorInterceptor);
      return ErrorInterceptor;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/_helpers/index.ts":
  /*!***********************************!*\
    !*** ./src/app/_helpers/index.ts ***!
    \***********************************/
  /*! exports provided: AuthGuard, ErrorInterceptor, RealBackendInterceptor, realBackendProvider, JwtInterceptor */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony import */ var _auth_guard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./auth.guard */ "./src/app/_helpers/auth.guard.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AuthGuard", function() { return _auth_guard__WEBPACK_IMPORTED_MODULE_0__["AuthGuard"]; });
  
  /* harmony import */ var _error_interceptor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./error.interceptor */ "./src/app/_helpers/error.interceptor.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ErrorInterceptor", function() { return _error_interceptor__WEBPACK_IMPORTED_MODULE_1__["ErrorInterceptor"]; });
  
  /* harmony import */ var _real_backend__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./real-backend */ "./src/app/_helpers/real-backend.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RealBackendInterceptor", function() { return _real_backend__WEBPACK_IMPORTED_MODULE_2__["RealBackendInterceptor"]; });
  
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "realBackendProvider", function() { return _real_backend__WEBPACK_IMPORTED_MODULE_2__["realBackendProvider"]; });
  
  /* harmony import */ var _jwt_interceptor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./jwt.interceptor */ "./src/app/_helpers/jwt.interceptor.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JwtInterceptor", function() { return _jwt_interceptor__WEBPACK_IMPORTED_MODULE_3__["JwtInterceptor"]; });
  
  
  
  
  
  
  
  /***/ }),
  
  /***/ "./src/app/_helpers/jwt.interceptor.ts":
  /*!*********************************************!*\
    !*** ./src/app/_helpers/jwt.interceptor.ts ***!
    \*********************************************/
  /*! exports provided: JwtInterceptor */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JwtInterceptor", function() { return JwtInterceptor; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @environments/environment */ "./src/environments/environment.ts");
  /* harmony import */ var _app_services__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @app/_services */ "./src/app/_services/index.ts");
  
  
  
  
  var JwtInterceptor = /** @class */ (function () {
      function JwtInterceptor(authenticationService) {
          this.authenticationService = authenticationService;
      }
      JwtInterceptor.prototype.intercept = function (request, next) {
          // add auth header with jwt if user is logged in and request is to api url
          var currentUser = this.authenticationService.currentUserValue;
          var isLoggedIn = currentUser && currentUser.token;
          var isApiUrl = request.url.startsWith(_environments_environment__WEBPACK_IMPORTED_MODULE_2__["environment"].apiUrl);
          if (isLoggedIn && isApiUrl) {
              request = request.clone({
                  setHeaders: {
                      Authorization: "Bearer " + currentUser.token
                  }
              });
          }
          return next.handle(request);
      };
      JwtInterceptor.ctorParameters = function () { return [
          { type: _app_services__WEBPACK_IMPORTED_MODULE_3__["AuthenticationService"] }
      ]; };
      JwtInterceptor = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
          tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_app_services__WEBPACK_IMPORTED_MODULE_3__["AuthenticationService"]])
      ], JwtInterceptor);
      return JwtInterceptor;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/_helpers/real-backend.ts":
  /*!******************************************!*\
    !*** ./src/app/_helpers/real-backend.ts ***!
    \******************************************/
  /*! exports provided: RealBackendInterceptor, realBackendProvider */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RealBackendInterceptor", function() { return RealBackendInterceptor; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "realBackendProvider", function() { return realBackendProvider; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common/http */ "./node_modules/@angular/common/fesm5/http.js");
  /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js");
  /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  /* harmony import */ var _app_models__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @app/_models */ "./src/app/_models/index.ts");
  
  
  
  
  
  
  var users = [
      { id: 1, user_email: 'admin@gmail.com', password: 'admin', firstName: 'Admin', lastName: 'User', role: _app_models__WEBPACK_IMPORTED_MODULE_5__["Role"].Admin },
      { id: 2, user_email: 'user@gmail.com', password: 'user', firstName: 'Normal', lastName: 'User', role: _app_models__WEBPACK_IMPORTED_MODULE_5__["Role"].User }
  ];
  var RealBackendInterceptor = /** @class */ (function () {
      function RealBackendInterceptor() {
      }
      RealBackendInterceptor.prototype.intercept = function (request, next) {
          var url = request.url, method = request.method, headers = request.headers, body = request.body;
          // wrap in delayed observable to simulate server api call
          return Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["of"])(null)
              .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["mergeMap"])(handleRoute))
              .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["materialize"])()) // call materialize and dematerialize to ensure delay even if an error is thrown (https://github.com/Reactive-Extensions/RxJS/issues/648)
              .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["delay"])(500))
              .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["dematerialize"])());
          function handleRoute() {
              switch (true) {
                  case url.endsWith('/users/authenticate') && method === 'POST':
                      return authenticate();
                  case url.endsWith('/register') && method === 'POST':
                      return register();
                  case url.endsWith('/users') && method === 'GET':
                      return getUsers();
                  case url.match(/\/users\/\d+$/) && method === 'GET':
                      return getUserById();
                  default:
                      // pass through any requests not handled above
                      return next.handle(request);
              }
          }
          // route function
          function register() {
              console.log("working");
              var firstName = body.firstName, lastName = body.lastName, user_email = body.user_email, password = body.password;
              var user = users.find(function (x) { return x.user_email === user_email; });
              if (user)
                  return error('Email Already in use');
          }
          function authenticate() {
              var user_email = body.user_email, password = body.password;
              var user = users.find(function (x) { return x.user_email === user_email && x.password === password; });
              if (!user)
                  return error('Email or password is incorrect');
              return ok({
                  id: user.id,
                  user_email: user.user_email,
                  firstName: user.firstName,
                  lastName: user.lastName,
                  role: user.role,
                  token: "fake-jwt-token." + user.id
              });
          }
          function getUsers() {
              if (!isAdmin())
                  return unauthorized();
              return ok(users);
          }
          function getUserById() {
              if (!isLoggedIn())
                  return unauthorized();
              // only admins can access other user records
              if (!isAdmin() && currentUser().id !== idFromUrl())
                  return unauthorized();
              var user = users.find(function (x) { return x.id === idFromUrl(); });
              return ok(user);
          }
          // helper functions
          function ok(body) {
              return Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["of"])(new _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpResponse"]({ status: 200, body: body }));
          }
          function unauthorized() {
              return Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["throwError"])({ status: 401, error: { message: 'unauthorized' } });
          }
          function error(message) {
              return Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["throwError"])({ status: 400, error: { message: message } });
          }
          function isLoggedIn() {
              var authHeader = headers.get('Authorization') || '';
              return authHeader.startsWith('Bearer fake-jwt-token');
          }
          function isAdmin() {
              return isLoggedIn() && currentUser().role === _app_models__WEBPACK_IMPORTED_MODULE_5__["Role"].Admin;
          }
          function currentUser() {
              if (!isLoggedIn())
                  return;
              var id = parseInt(headers.get('Authorization').split('.')[1]);
              return users.find(function (x) { return x.id === id; });
          }
          function idFromUrl() {
              var urlParts = url.split('/');
              return parseInt(urlParts[urlParts.length - 1]);
          }
      };
      RealBackendInterceptor = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])()
      ], RealBackendInterceptor);
      return RealBackendInterceptor;
  }());
  
  var realBackendProvider = {
      // use fake backend in place of Http service for backend-less development
      provide: _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HTTP_INTERCEPTORS"],
      useClass: RealBackendInterceptor,
      multi: true
  };
  
  
  /***/ }),
  
  /***/ "./src/app/_models/index.ts":
  /*!**********************************!*\
    !*** ./src/app/_models/index.ts ***!
    \**********************************/
  /*! exports provided: Role, User */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony import */ var _role__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./role */ "./src/app/_models/role.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Role", function() { return _role__WEBPACK_IMPORTED_MODULE_0__["Role"]; });
  
  /* harmony import */ var _user__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./user */ "./src/app/_models/user.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "User", function() { return _user__WEBPACK_IMPORTED_MODULE_1__["User"]; });
  
  
  
  
  
  /***/ }),
  
  /***/ "./src/app/_models/role.ts":
  /*!*********************************!*\
    !*** ./src/app/_models/role.ts ***!
    \*********************************/
  /*! exports provided: Role */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Role", function() { return Role; });
  var Role;
  (function (Role) {
      Role["User"] = "User";
      Role["Admin"] = "Admin";
  })(Role || (Role = {}));
  
  
  /***/ }),
  
  /***/ "./src/app/_models/user.ts":
  /*!*********************************!*\
    !*** ./src/app/_models/user.ts ***!
    \*********************************/
  /*! exports provided: User */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "User", function() { return User; });
  var User = /** @class */ (function () {
      function User() {
      }
      return User;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/_services/authentication.service.ts":
  /*!*****************************************************!*\
    !*** ./src/app/_services/authentication.service.ts ***!
    \*****************************************************/
  /*! exports provided: AuthenticationService */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AuthenticationService", function() { return AuthenticationService; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common/http */ "./node_modules/@angular/common/fesm5/http.js");
  /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js");
  /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  /* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @environments/environment */ "./src/environments/environment.ts");
  
  
  
  
  
  
  var AuthenticationService = /** @class */ (function () {
      function AuthenticationService(http) {
          this.http = http;
          this.currentUserSubject = new rxjs__WEBPACK_IMPORTED_MODULE_3__["BehaviorSubject"](JSON.parse(localStorage.getItem('currentUser')));
          this.currentUser = this.currentUserSubject.asObservable();
      }
      Object.defineProperty(AuthenticationService.prototype, "currentUserValue", {
          get: function () {
              return this.currentUserSubject.value;
          },
          enumerable: true,
          configurable: true
      });
      AuthenticationService.prototype.register = function (firstName, lastName, user_email, password) {
          var _this = this;
          return this.http.post(_environments_environment__WEBPACK_IMPORTED_MODULE_5__["environment"].apiUrl + "/register", { firstName: firstName, lastName: lastName, user_email: user_email, password: password })
              .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["map"])(function (user) {
              // login successful if there's a jwt token in the response
              if (user && user.token) {
                  // store user details and jwt token in local storage to keep user logged in between page refreshes
                  localStorage.setItem('currentUser', JSON.stringify(user));
                  _this.currentUserSubject.next(user);
              }
              return user;
          }));
      };
      AuthenticationService.prototype.login = function (username, password) {
          var _this = this;
          return this.http.post(_environments_environment__WEBPACK_IMPORTED_MODULE_5__["environment"].apiUrl + "/users/authenticate", { username: username, password: password })
              .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["map"])(function (user) {
              // login successful if there's a jwt token in the response
              if (user && user.token) {
                  // store user details and jwt token in local storage to keep user logged in between page refreshes
                  localStorage.setItem('currentUser', JSON.stringify(user));
                  _this.currentUserSubject.next(user);
              }
              return user;
          }));
      };
      AuthenticationService.prototype.logout = function () {
          // remove user from local storage to log user out
          localStorage.removeItem('currentUser');
          this.currentUserSubject.next(null);
      };
      AuthenticationService.ctorParameters = function () { return [
          { type: _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpClient"] }
      ]; };
      AuthenticationService = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])({ providedIn: 'root' }),
          tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpClient"]])
      ], AuthenticationService);
      return AuthenticationService;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/_services/index.ts":
  /*!************************************!*\
    !*** ./src/app/_services/index.ts ***!
    \************************************/
  /*! exports provided: AuthenticationService, UserService */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony import */ var _authentication_service__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./authentication.service */ "./src/app/_services/authentication.service.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AuthenticationService", function() { return _authentication_service__WEBPACK_IMPORTED_MODULE_0__["AuthenticationService"]; });
  
  /* harmony import */ var _user_service__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./user.service */ "./src/app/_services/user.service.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UserService", function() { return _user_service__WEBPACK_IMPORTED_MODULE_1__["UserService"]; });
  
  
  
  
  
  /***/ }),
  
  /***/ "./src/app/_services/user.service.ts":
  /*!*******************************************!*\
    !*** ./src/app/_services/user.service.ts ***!
    \*******************************************/
  /*! exports provided: UserService */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UserService", function() { return UserService; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common/http */ "./node_modules/@angular/common/fesm5/http.js");
  /* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @environments/environment */ "./src/environments/environment.ts");
  
  
  
  
  var UserService = /** @class */ (function () {
      function UserService(http) {
          this.http = http;
      }
      UserService.prototype.getAll = function () {
          return this.http.get(_environments_environment__WEBPACK_IMPORTED_MODULE_3__["environment"].apiUrl + "/users");
      };
      UserService.prototype.getById = function (id) {
          return this.http.get(_environments_environment__WEBPACK_IMPORTED_MODULE_3__["environment"].apiUrl + "/users/" + id);
      };
      UserService.ctorParameters = function () { return [
          { type: _angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpClient"] }
      ]; };
      UserService = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])({ providedIn: 'root' }),
          tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_angular_common_http__WEBPACK_IMPORTED_MODULE_2__["HttpClient"]])
      ], UserService);
      return UserService;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/admin/admin.component.ts":
  /*!******************************************!*\
    !*** ./src/app/admin/admin.component.ts ***!
    \******************************************/
  /*! exports provided: AdminComponent */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AdminComponent", function() { return AdminComponent; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  /* harmony import */ var _app_services__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @app/_services */ "./src/app/_services/index.ts");
  
  
  
  
  var AdminComponent = /** @class */ (function () {
      function AdminComponent(userService) {
          this.userService = userService;
          this.loading = false;
          this.users = [];
      }
      AdminComponent.prototype.ngOnInit = function () {
          var _this = this;
          this.loading = true;
          this.userService.getAll().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["first"])()).subscribe(function (users) {
              _this.loading = false;
              _this.users = users;
          });
      };
      AdminComponent.ctorParameters = function () { return [
          { type: _app_services__WEBPACK_IMPORTED_MODULE_3__["UserService"] }
      ]; };
      AdminComponent = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({ template: __webpack_require__(/*! raw-loader!./admin.component.html */ "./node_modules/raw-loader/index.js!./src/app/admin/admin.component.html") }),
          tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_app_services__WEBPACK_IMPORTED_MODULE_3__["UserService"]])
      ], AdminComponent);
      return AdminComponent;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/admin/index.ts":
  /*!********************************!*\
    !*** ./src/app/admin/index.ts ***!
    \********************************/
  /*! exports provided: AdminComponent */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony import */ var _admin_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./admin.component */ "./src/app/admin/admin.component.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AdminComponent", function() { return _admin_component__WEBPACK_IMPORTED_MODULE_0__["AdminComponent"]; });
  
  
  
  
  /***/ }),
  
  /***/ "./src/app/app.component.ts":
  /*!**********************************!*\
    !*** ./src/app/app.component.ts ***!
    \**********************************/
  /*! exports provided: AppComponent */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppComponent", function() { return AppComponent; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  /* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_services */ "./src/app/_services/index.ts");
  /* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_models */ "./src/app/_models/index.ts");
  
  
  
  
  
  var AppComponent = /** @class */ (function () {
      function AppComponent(router, authenticationService) {
          var _this = this;
          this.router = router;
          this.authenticationService = authenticationService;
          this.authenticationService.currentUser.subscribe(function (x) { return _this.currentUser = x; });
      }
      Object.defineProperty(AppComponent.prototype, "isAdmin", {
          get: function () {
              return this.currentUser && this.currentUser.role === _models__WEBPACK_IMPORTED_MODULE_4__["Role"].Admin;
          },
          enumerable: true,
          configurable: true
      });
      AppComponent.prototype.logout = function () {
          this.authenticationService.logout();
          this.router.navigate(['/login']);
      };
      AppComponent.ctorParameters = function () { return [
          { type: _angular_router__WEBPACK_IMPORTED_MODULE_2__["Router"] },
          { type: _services__WEBPACK_IMPORTED_MODULE_3__["AuthenticationService"] }
      ]; };
      AppComponent = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({ selector: 'app', template: __webpack_require__(/*! raw-loader!./app.component.html */ "./node_modules/raw-loader/index.js!./src/app/app.component.html") }),
          tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_angular_router__WEBPACK_IMPORTED_MODULE_2__["Router"],
              _services__WEBPACK_IMPORTED_MODULE_3__["AuthenticationService"]])
      ], AppComponent);
      return AppComponent;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/app.module.ts":
  /*!*******************************!*\
    !*** ./src/app/app.module.ts ***!
    \*******************************/
  /*! exports provided: AppModule */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppModule", function() { return AppModule; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js");
  /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js");
  /* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/common/http */ "./node_modules/@angular/common/fesm5/http.js");
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./_helpers */ "./src/app/_helpers/index.ts");
  /* harmony import */ var _app_component__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./app.component */ "./src/app/app.component.ts");
  /* harmony import */ var _app_routing__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./app.routing */ "./src/app/app.routing.ts");
  /* harmony import */ var _home__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./home */ "./src/app/home/index.ts");
  /* harmony import */ var _admin__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./admin */ "./src/app/admin/index.ts");
  /* harmony import */ var _login__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./login */ "./src/app/login/index.ts");
  /* harmony import */ var _register__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./register */ "./src/app/register/index.ts");
  
  
  
  
  
  // used to create fake backend
  
  
  
  
  
  
  
  
  var AppModule = /** @class */ (function () {
      function AppModule() {
      }
      AppModule = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
              imports: [
                  _angular_platform_browser__WEBPACK_IMPORTED_MODULE_2__["BrowserModule"],
                  _angular_forms__WEBPACK_IMPORTED_MODULE_3__["ReactiveFormsModule"],
                  _angular_common_http__WEBPACK_IMPORTED_MODULE_4__["HttpClientModule"],
                  _app_routing__WEBPACK_IMPORTED_MODULE_7__["appRoutingModule"]
              ],
              declarations: [
                  _app_component__WEBPACK_IMPORTED_MODULE_6__["AppComponent"],
                  _home__WEBPACK_IMPORTED_MODULE_8__["HomeComponent"],
                  _admin__WEBPACK_IMPORTED_MODULE_9__["AdminComponent"],
                  _login__WEBPACK_IMPORTED_MODULE_10__["LoginComponent"],
                  _register__WEBPACK_IMPORTED_MODULE_11__["RegisterComponent"]
              ],
              providers: [
                  { provide: _angular_common_http__WEBPACK_IMPORTED_MODULE_4__["HTTP_INTERCEPTORS"], useClass: _helpers__WEBPACK_IMPORTED_MODULE_5__["JwtInterceptor"], multi: true },
                  { provide: _angular_common_http__WEBPACK_IMPORTED_MODULE_4__["HTTP_INTERCEPTORS"], useClass: _helpers__WEBPACK_IMPORTED_MODULE_5__["ErrorInterceptor"], multi: true },
                  // provider used to create fake backend
                  _helpers__WEBPACK_IMPORTED_MODULE_5__["realBackendProvider"]
              ],
              bootstrap: [_app_component__WEBPACK_IMPORTED_MODULE_6__["AppComponent"]]
          })
      ], AppModule);
      return AppModule;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/app.routing.ts":
  /*!********************************!*\
    !*** ./src/app/app.routing.ts ***!
    \********************************/
  /*! exports provided: appRoutingModule */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "appRoutingModule", function() { return appRoutingModule; });
  /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  /* harmony import */ var _home__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./home */ "./src/app/home/index.ts");
  /* harmony import */ var _admin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./admin */ "./src/app/admin/index.ts");
  /* harmony import */ var _login__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./login */ "./src/app/login/index.ts");
  /* harmony import */ var _register__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./register */ "./src/app/register/index.ts");
  /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./_helpers */ "./src/app/_helpers/index.ts");
  /* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./_models */ "./src/app/_models/index.ts");
  
  
  
  
  
  
  
  var routes = [
      {
          path: '',
          component: _home__WEBPACK_IMPORTED_MODULE_1__["HomeComponent"],
          canActivate: [_helpers__WEBPACK_IMPORTED_MODULE_5__["AuthGuard"]]
      },
      {
          path: 'admin',
          component: _admin__WEBPACK_IMPORTED_MODULE_2__["AdminComponent"],
          canActivate: [_helpers__WEBPACK_IMPORTED_MODULE_5__["AuthGuard"]],
          data: { roles: [_models__WEBPACK_IMPORTED_MODULE_6__["Role"].Admin] }
      },
      {
          path: 'login',
          component: _login__WEBPACK_IMPORTED_MODULE_3__["LoginComponent"]
      },
      {
          path: 'register',
          component: _register__WEBPACK_IMPORTED_MODULE_4__["RegisterComponent"]
      },
      // otherwise redirect to home
      { path: '**', redirectTo: '' }
  ];
  var appRoutingModule = _angular_router__WEBPACK_IMPORTED_MODULE_0__["RouterModule"].forRoot(routes);
  
  
  /***/ }),
  
  /***/ "./src/app/home/home.component.ts":
  /*!****************************************!*\
    !*** ./src/app/home/home.component.ts ***!
    \****************************************/
  /*! exports provided: HomeComponent */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HomeComponent", function() { return HomeComponent; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  /* harmony import */ var _app_services__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @app/_services */ "./src/app/_services/index.ts");
  
  
  
  
  var HomeComponent = /** @class */ (function () {
      function HomeComponent(userService, authenticationService) {
          this.userService = userService;
          this.authenticationService = authenticationService;
          this.loading = false;
          this.currentUser = this.authenticationService.currentUserValue;
      }
      HomeComponent.prototype.ngOnInit = function () {
          var _this = this;
          this.loading = true;
          this.userService.getById(this.currentUser.id).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["first"])()).subscribe(function (user) {
              _this.loading = false;
              _this.userFromApi = user;
          });
      };
      HomeComponent.ctorParameters = function () { return [
          { type: _app_services__WEBPACK_IMPORTED_MODULE_3__["UserService"] },
          { type: _app_services__WEBPACK_IMPORTED_MODULE_3__["AuthenticationService"] }
      ]; };
      HomeComponent = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({ template: __webpack_require__(/*! raw-loader!./home.component.html */ "./node_modules/raw-loader/index.js!./src/app/home/home.component.html") }),
          tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_app_services__WEBPACK_IMPORTED_MODULE_3__["UserService"],
              _app_services__WEBPACK_IMPORTED_MODULE_3__["AuthenticationService"]])
      ], HomeComponent);
      return HomeComponent;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/home/index.ts":
  /*!*******************************!*\
    !*** ./src/app/home/index.ts ***!
    \*******************************/
  /*! exports provided: HomeComponent */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony import */ var _home_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./home.component */ "./src/app/home/home.component.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HomeComponent", function() { return _home_component__WEBPACK_IMPORTED_MODULE_0__["HomeComponent"]; });
  
  
  
  
  /***/ }),
  
  /***/ "./src/app/login/index.ts":
  /*!********************************!*\
    !*** ./src/app/login/index.ts ***!
    \********************************/
  /*! exports provided: LoginComponent */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony import */ var _login_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./login.component */ "./src/app/login/login.component.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LoginComponent", function() { return _login_component__WEBPACK_IMPORTED_MODULE_0__["LoginComponent"]; });
  
  
  
  
  /***/ }),
  
  /***/ "./src/app/login/login.component.ts":
  /*!******************************************!*\
    !*** ./src/app/login/login.component.ts ***!
    \******************************************/
  /*! exports provided: LoginComponent */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LoginComponent", function() { return LoginComponent; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js");
  /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  /* harmony import */ var _app_services__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @app/_services */ "./src/app/_services/index.ts");
  
  
  
  
  
  
  var LoginComponent = /** @class */ (function () {
      function LoginComponent(formBuilder, route, router, authenticationService) {
          this.formBuilder = formBuilder;
          this.route = route;
          this.router = router;
          this.authenticationService = authenticationService;
          this.loading = false;
          this.submitted = false;
          this.error = '';
          // redirect to home if already logged in
          if (this.authenticationService.currentUserValue) {
              this.router.navigate(['/']);
          }
      }
      LoginComponent.prototype.ngOnInit = function () {
          this.loginForm = this.formBuilder.group({
              user_email: ['', [_angular_forms__WEBPACK_IMPORTED_MODULE_3__["Validators"].required, _angular_forms__WEBPACK_IMPORTED_MODULE_3__["Validators"].email]],
              password: ['', _angular_forms__WEBPACK_IMPORTED_MODULE_3__["Validators"].required]
          });
          // get return url from route parameters or default to '/'
          this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
      };
      Object.defineProperty(LoginComponent.prototype, "f", {
          // convenience getter for easy access to form fields
          get: function () { return this.loginForm.controls; },
          enumerable: true,
          configurable: true
      });
      LoginComponent.prototype.onSubmit = function () {
          var _this = this;
          this.submitted = true;
          // stop here if form is invalid
          if (this.loginForm.invalid) {
              return;
          }
          this.loading = true;
          this.authenticationService.login(this.f.username.value, this.f.password.value)
              .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["first"])())
              .subscribe(function (data) {
              _this.router.navigate([_this.returnUrl]);
          }, function (error) {
              _this.error = error;
              _this.loading = false;
          });
      };
      LoginComponent.ctorParameters = function () { return [
          { type: _angular_forms__WEBPACK_IMPORTED_MODULE_3__["FormBuilder"] },
          { type: _angular_router__WEBPACK_IMPORTED_MODULE_2__["ActivatedRoute"] },
          { type: _angular_router__WEBPACK_IMPORTED_MODULE_2__["Router"] },
          { type: _app_services__WEBPACK_IMPORTED_MODULE_5__["AuthenticationService"] }
      ]; };
      LoginComponent = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({ template: __webpack_require__(/*! raw-loader!./login.component.html */ "./node_modules/raw-loader/index.js!./src/app/login/login.component.html") }),
          tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_angular_forms__WEBPACK_IMPORTED_MODULE_3__["FormBuilder"],
              _angular_router__WEBPACK_IMPORTED_MODULE_2__["ActivatedRoute"],
              _angular_router__WEBPACK_IMPORTED_MODULE_2__["Router"],
              _app_services__WEBPACK_IMPORTED_MODULE_5__["AuthenticationService"]])
      ], LoginComponent);
      return LoginComponent;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/app/register/index.ts":
  /*!***********************************!*\
    !*** ./src/app/register/index.ts ***!
    \***********************************/
  /*! exports provided: RegisterComponent */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony import */ var _register_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./register.component */ "./src/app/register/register.component.ts");
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RegisterComponent", function() { return _register_component__WEBPACK_IMPORTED_MODULE_0__["RegisterComponent"]; });
  
  
  
  
  /***/ }),
  
  /***/ "./src/app/register/register.component.ts":
  /*!************************************************!*\
    !*** ./src/app/register/register.component.ts ***!
    \************************************************/
  /*! exports provided: RegisterComponent */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RegisterComponent", function() { return RegisterComponent; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm5/router.js");
  /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm5/forms.js");
  /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  /* harmony import */ var _app_services__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @app/_services */ "./src/app/_services/index.ts");
  
  
  
  
  
  
  var RegisterComponent = /** @class */ (function () {
      function RegisterComponent(formBuilder, route, router, authenticationService) {
          this.formBuilder = formBuilder;
          this.route = route;
          this.router = router;
          this.authenticationService = authenticationService;
          this.loading = false;
          this.submitted = false;
          this.error = '';
          // redirect to home if already logged in
          if (this.authenticationService.currentUserValue) {
              this.router.navigate(['/']);
          }
      }
      RegisterComponent.prototype.ngOnInit = function () {
          this.registerForm = this.formBuilder.group({
              firstName: ['', _angular_forms__WEBPACK_IMPORTED_MODULE_3__["Validators"].required],
              lastName: ['', _angular_forms__WEBPACK_IMPORTED_MODULE_3__["Validators"].required],
              user_email: ['', [_angular_forms__WEBPACK_IMPORTED_MODULE_3__["Validators"].required, _angular_forms__WEBPACK_IMPORTED_MODULE_3__["Validators"].email]],
              password: ['', _angular_forms__WEBPACK_IMPORTED_MODULE_3__["Validators"].required]
          });
          // get return url from route parameters or default to '/'
          this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
      };
      Object.defineProperty(RegisterComponent.prototype, "f", {
          // convenience getter for easy access to form fields
          get: function () { return this.registerForm.controls; },
          enumerable: true,
          configurable: true
      });
      RegisterComponent.prototype.onSubmit = function () {
          var _this = this;
          this.submitted = true;
          // stop here if form is invalid
          if (this.registerForm.invalid) {
              return;
          }
          this.loading = true;
          this.authenticationService.register(this.f.firstName.value, this.f.lastName.value, this.f.user_email.value, this.f.password.value)
              .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["first"])())
              .subscribe(function (data) {
              _this.router.navigate([_this.returnUrl]);
          }, function (error) {
              _this.error = error;
              _this.loading = false;
          });
      };
      RegisterComponent.ctorParameters = function () { return [
          { type: _angular_forms__WEBPACK_IMPORTED_MODULE_3__["FormBuilder"] },
          { type: _angular_router__WEBPACK_IMPORTED_MODULE_2__["ActivatedRoute"] },
          { type: _angular_router__WEBPACK_IMPORTED_MODULE_2__["Router"] },
          { type: _app_services__WEBPACK_IMPORTED_MODULE_5__["AuthenticationService"] }
      ]; };
      RegisterComponent = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
          Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({ template: __webpack_require__(/*! raw-loader!./register.component.html */ "./node_modules/raw-loader/index.js!./src/app/register/register.component.html") }),
          tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_angular_forms__WEBPACK_IMPORTED_MODULE_3__["FormBuilder"],
              _angular_router__WEBPACK_IMPORTED_MODULE_2__["ActivatedRoute"],
              _angular_router__WEBPACK_IMPORTED_MODULE_2__["Router"],
              _app_services__WEBPACK_IMPORTED_MODULE_5__["AuthenticationService"]])
      ], RegisterComponent);
      return RegisterComponent;
  }());
  
  
  
  /***/ }),
  
  /***/ "./src/environments/environment.ts":
  /*!*****************************************!*\
    !*** ./src/environments/environment.ts ***!
    \*****************************************/
  /*! exports provided: environment */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "environment", function() { return environment; });
  // This file can be replaced during build by using the `fileReplacements` array.
  // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
  // The list of file replacements can be found in `angular.json`.
  var environment = {
      production: false,
      apiUrl: 'http://localhost:4000'
  };
  /*
   * For easier debugging in development mode, you can import the following file
   * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
   *
   * This import should be commented out in production mode because it will have a negative impact
   * on performance if an error is thrown.
   */
  // import 'zone.js/dist/zone-error';  // Included with Angular CLI.
  
  
  /***/ }),
  
  /***/ "./src/main.ts":
  /*!*********************!*\
    !*** ./src/main.ts ***!
    \*********************/
  /*! no exports provided */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  /* harmony import */ var _angular_platform_browser_dynamic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/platform-browser-dynamic */ "./node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js");
  /* harmony import */ var _app_app_module__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./app/app.module */ "./src/app/app.module.ts");
  /* harmony import */ var _environments_environment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./environments/environment */ "./src/environments/environment.ts");
  
  
  
  
  if (_environments_environment__WEBPACK_IMPORTED_MODULE_3__["environment"].production) {
      Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["enableProdMode"])();
  }
  Object(_angular_platform_browser_dynamic__WEBPACK_IMPORTED_MODULE_1__["platformBrowserDynamic"])().bootstrapModule(_app_app_module__WEBPACK_IMPORTED_MODULE_2__["AppModule"])
      .catch(function (err) { return console.error(err); });
  
  
  /***/ }),
  
  /***/ 0:
  /*!***************************!*\
    !*** multi ./src/main.ts ***!
    \***************************/
  /*! no static exports found */
  /***/ (function(module, exports, __webpack_require__) {
  
  module.exports = __webpack_require__(/*! E:\My Work Directory\Custom_API_testing\role_based_authentication\src\main.ts */"./src/main.ts");
  
  
  /***/ })
  
  },[[0,"runtime","vendor"]]]);
  //# sourceMappingURL=main-es5.js.map