Environment Setup for Test
This commit is contained in:
parent
e8de2e46fb
commit
f1f43227f9
@ -64,6 +64,22 @@
|
|||||||
"with": "src/environments/environment.prod.ts"
|
"with": "src/environments/environment.prod.ts"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"staging": {
|
||||||
|
"optimization": true,
|
||||||
|
"outputHashing": "all",
|
||||||
|
"sourceMap": false,
|
||||||
|
"extractCss": true,
|
||||||
|
"namedChunks": false,
|
||||||
|
"aot": true,
|
||||||
|
"extractLicenses": true,
|
||||||
|
"vendorChunk": false,
|
||||||
|
"buildOptimizer": true,
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.stage.ts"
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "optima",
|
"name": "pd_genie_web_application",
|
||||||
"version": "0.0.0",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prod": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod --build-optimizer=true",
|
"production": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod ",
|
||||||
|
"staging": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod --configuration=staging",
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build",
|
||||||
|
|||||||
@ -23,40 +23,33 @@ import 'rxjs/add/operator/map';
|
|||||||
import { CognitoService } from './cognito.service';
|
import { CognitoService } from './cognito.service';
|
||||||
|
|
||||||
|
|
||||||
|
const se_poolData = {
|
||||||
// const sineedge_poolData = {
|
UserPoolId: environment.seUserPoolId, // UserName :SPARQ_SINEEDGE_DEV
|
||||||
// UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
|
ClientId: environment.seClientId// ClientName: SINEEDGE_DEV_WEB
|
||||||
// ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
|
|
||||||
// };
|
|
||||||
const sineedgedev_poolData = {
|
|
||||||
UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV
|
|
||||||
ClientId: "67b4fnbuols5upms5to8bvqddh"// ClientName: SINEEDGE_DEV_WEB
|
|
||||||
}
|
}
|
||||||
// client id changed on 12-04-2019 by kms
|
// client id changed on 12-04-2019 by kms
|
||||||
//ClientId: "2o5c3cs9k3als16nqhp3irh8rs"
|
//ClientId: "2o5c3cs9k3als16nqhp3irh8rs"
|
||||||
|
|
||||||
const lender_poolData = {
|
const lender_poolData = {
|
||||||
UserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV
|
UserPoolId: environment.lenUserPoolId, // Username :SPARQ_LENDER_DEV
|
||||||
ClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName:LENDER_DEV_WEB
|
ClientId: environment.lenClientId // ClientName:LENDER_DEV_WEB
|
||||||
};
|
};
|
||||||
|
|
||||||
const vendor_poolData = {
|
const vendor_poolData = {
|
||||||
UserPoolId: "ap-south-1_K57yPaWxV",
|
UserPoolId: environment.venUserPoolId,
|
||||||
ClientId: ""
|
ClientId: environment.venClientId
|
||||||
}
|
}
|
||||||
// const sineedgeUserPool = new CognitoUserPool(sineedge_poolData);
|
|
||||||
|
const sineedgeUserpool = new CognitoUserPool(se_poolData);
|
||||||
const lenderUserPool = new CognitoUserPool(lender_poolData);
|
const lenderUserPool = new CognitoUserPool(lender_poolData);
|
||||||
const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identity PoolID
|
* Identity PoolID
|
||||||
*/
|
*/
|
||||||
const sineedgeIdentity = "ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";//"ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";
|
const sineedgeIdentity = environment.seIdentityPoolId;
|
||||||
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
|
const lenderIdentity = environment.lenIdentityPoolId;
|
||||||
const vendorIdenttiy = "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874";
|
const vendorIdenttiy = environment.venIdentityPoolId;
|
||||||
// serviceProvider
|
|
||||||
const apiurl = environment.apiEndpoint;
|
|
||||||
//const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
|
|
||||||
//const apiurl = "http://localhost/sparqapi/api/";
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: "root"
|
providedIn: "root"
|
||||||
@ -85,7 +78,7 @@ export class AwsService {
|
|||||||
let attributesData = [];
|
let attributesData = [];
|
||||||
const userData = {
|
const userData = {
|
||||||
Username: authenticationData.Username, // User email id
|
Username: authenticationData.Username, // User email id
|
||||||
Pool: sineedgedevUserpool // user Pool ID
|
Pool: sineedgeUserpool // user Pool ID
|
||||||
};
|
};
|
||||||
let cognitoUser = new CognitoUser(userData);
|
let cognitoUser = new CognitoUser(userData);
|
||||||
return Observable.create(observer => {
|
return Observable.create(observer => {
|
||||||
@ -132,7 +125,7 @@ export class AwsService {
|
|||||||
////(auth);
|
////(auth);
|
||||||
const userData = {
|
const userData = {
|
||||||
Username: auth.Username,
|
Username: auth.Username,
|
||||||
Pool: sineedgedevUserpool
|
Pool: sineedgeUserpool
|
||||||
};
|
};
|
||||||
let cognitoUser = new CognitoUser(userData);
|
let cognitoUser = new CognitoUser(userData);
|
||||||
return Observable.create(observe => {
|
return Observable.create(observe => {
|
||||||
@ -228,7 +221,7 @@ export class AwsService {
|
|||||||
if (userGroup == 'ADMIN') {
|
if (userGroup == 'ADMIN') {
|
||||||
if (userdata.fk_entity_type_id == 1) {
|
if (userdata.fk_entity_type_id == 1) {
|
||||||
params = {
|
params = {
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
UserPoolId: se_poolData.UserPoolId, /* required */
|
||||||
Username: awsName /* required */
|
Username: awsName /* required */
|
||||||
};
|
};
|
||||||
} else if (userdata.fk_entity_type_id == 2) {
|
} else if (userdata.fk_entity_type_id == 2) {
|
||||||
@ -275,7 +268,7 @@ export class AwsService {
|
|||||||
|
|
||||||
if (userdata.fk_entity_type_id == 1) {
|
if (userdata.fk_entity_type_id == 1) {
|
||||||
params = {
|
params = {
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
UserPoolId: se_poolData.UserPoolId, /* required */
|
||||||
Username: awsName /* required */
|
Username: awsName /* required */
|
||||||
};
|
};
|
||||||
} else if (userdata.fk_entity_type_id == 2) {
|
} else if (userdata.fk_entity_type_id == 2) {
|
||||||
@ -310,7 +303,7 @@ export class AwsService {
|
|||||||
if (userGroup == "ADMIN") {
|
if (userGroup == "ADMIN") {
|
||||||
if (userData.type.entity_type_id == 1) {
|
if (userData.type.entity_type_id == 1) {
|
||||||
params = {
|
params = {
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId /* required */,
|
UserPoolId: se_poolData.UserPoolId /* required */,
|
||||||
Username: userData.email /* required */,
|
Username: userData.email /* required */,
|
||||||
DesiredDeliveryMediums: [
|
DesiredDeliveryMediums: [
|
||||||
"EMAIL"
|
"EMAIL"
|
||||||
@ -425,14 +418,14 @@ export class AwsService {
|
|||||||
if(userData.userid === undefined){
|
if(userData.userid === undefined){
|
||||||
params = {
|
params = {
|
||||||
GroupName: "ADMIN" /* required */,
|
GroupName: "ADMIN" /* required */,
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
UserPoolId: se_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||||
Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||||
};
|
};
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
params = {
|
params = {
|
||||||
GroupName: "ADMIN" /* required */,
|
GroupName: "ADMIN" /* required */,
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
UserPoolId: se_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||||
Username: userData.aws_name //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
Username: userData.aws_name //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -492,7 +485,7 @@ export class AwsService {
|
|||||||
}
|
}
|
||||||
/* more items */
|
/* more items */
|
||||||
],
|
],
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
UserPoolId: se_poolData.UserPoolId, /* required */
|
||||||
Username: user.email /* required */
|
Username: user.email /* required */
|
||||||
};
|
};
|
||||||
}else if(user.type.entity_type_id ==2){
|
}else if(user.type.entity_type_id ==2){
|
||||||
@ -563,7 +556,7 @@ export class AwsService {
|
|||||||
if (userGroup == "ADMIN") {
|
if (userGroup == "ADMIN") {
|
||||||
if (userData.fk_entity_type_id == 1) {
|
if (userData.fk_entity_type_id == 1) {
|
||||||
params = {
|
params = {
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId /* required */,
|
UserPoolId: se_poolData.UserPoolId /* required */,
|
||||||
Username: userData.aws_name,//userData.email /* required */,
|
Username: userData.aws_name,//userData.email /* required */,
|
||||||
|
|
||||||
// ForceAliasCreation: true || false,
|
// ForceAliasCreation: true || false,
|
||||||
@ -687,7 +680,7 @@ adminresetpassword(awsuser){
|
|||||||
let params:any;
|
let params:any;
|
||||||
if(awsuser.fk_entity_id ==1){
|
if(awsuser.fk_entity_id ==1){
|
||||||
params= {
|
params= {
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
UserPoolId: se_poolData.UserPoolId, /* required */
|
||||||
Username: awsuser.email /* required */
|
Username: awsuser.email /* required */
|
||||||
};
|
};
|
||||||
}else if(awsuser.fk_entity_id ==2){
|
}else if(awsuser.fk_entity_id ==2){
|
||||||
@ -730,7 +723,7 @@ admindelete(aws){
|
|||||||
let params:any;
|
let params:any;
|
||||||
if(aws.fk_entity_id ==1){
|
if(aws.fk_entity_id ==1){
|
||||||
params= {
|
params= {
|
||||||
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
UserPoolId: se_poolData.UserPoolId, /* required */
|
||||||
Username: aws.email /* required */
|
Username: aws.email /* required */
|
||||||
};
|
};
|
||||||
}else if(aws.fk_entity_id ==2){
|
}else if(aws.fk_entity_id ==2){
|
||||||
@ -756,7 +749,7 @@ adminlistgroup(enitiy){
|
|||||||
let params:any;
|
let params:any;
|
||||||
if(enitiy ==1){
|
if(enitiy ==1){
|
||||||
params = {
|
params = {
|
||||||
UserPoolId:sineedgedev_poolData.UserPoolId,
|
UserPoolId:se_poolData.UserPoolId,
|
||||||
}
|
}
|
||||||
}else if(enitiy ==2){
|
}else if(enitiy ==2){
|
||||||
params = {
|
params = {
|
||||||
|
|||||||
@ -13,36 +13,36 @@ import {
|
|||||||
import { environment } from '../../environments/environment';
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
import { BehaviorSubject,Observable,of } from 'rxjs';
|
import { BehaviorSubject,Observable,of } from 'rxjs';
|
||||||
|
// const sineedge_poolData = {
|
||||||
|
// UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
|
||||||
|
// ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
|
||||||
|
// };
|
||||||
|
|
||||||
const sineedge_poolData = {
|
const sineedge_poolData = {
|
||||||
UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
|
UserPoolId: environment.seUserPoolId, // UserName
|
||||||
ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
|
ClientId: environment.seClientId // ClientName
|
||||||
};
|
|
||||||
const sineedgedev_poolData = {
|
|
||||||
UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV
|
|
||||||
ClientId: "67b4fnbuols5upms5to8bvqddh" // ClientName: SINEEDGE_DEV_WEB
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const lender_poolData = {
|
const lender_poolData = {
|
||||||
UserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV
|
UserPoolId: environment.lenUserPoolId, // UserName
|
||||||
ClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName:LENDER_DEV_WEB
|
ClientId: environment.lenClientId // ClientName
|
||||||
};
|
};
|
||||||
|
|
||||||
const vendor_poolData = {
|
const vendor_poolData = {
|
||||||
UserPoolId: "",
|
UserPoolId: environment.venUserPoolId, // UserName
|
||||||
ClientId: ""
|
ClientId: environment.venClientId // ClientName
|
||||||
}
|
}
|
||||||
const sineedgeUserPool = new CognitoUserPool(sineedge_poolData);
|
|
||||||
|
const sineedgeUserpool = new CognitoUserPool(sineedge_poolData);
|
||||||
const lenderUserPool = new CognitoUserPool(lender_poolData);
|
const lenderUserPool = new CognitoUserPool(lender_poolData);
|
||||||
const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identity PoolID
|
* Identity PoolID
|
||||||
*/
|
*/
|
||||||
const sineedgeIdentity = "ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";//"ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";
|
const sineedgeIdentity = environment.seIdentityPoolId;//"ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";
|
||||||
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
|
const lenderIdentity = environment.lenIdentityPoolId;
|
||||||
const vendorIdenttiy = "";
|
const vendorIdenttiy = environment.venIdentityPoolId;
|
||||||
// serviceProvider
|
|
||||||
//const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
|
|
||||||
const apiurl = environment.apiEndpoint;
|
|
||||||
// const apiurl = "http://localhost/sparqapi/api/";
|
|
||||||
|
|
||||||
export interface Callback {
|
export interface Callback {
|
||||||
callback(): void;
|
callback(): void;
|
||||||
@ -55,6 +55,7 @@ export interface Callback {
|
|||||||
})
|
})
|
||||||
export class CognitoService implements CanActivateChild {
|
export class CognitoService implements CanActivateChild {
|
||||||
public loggedIn :boolean = false;
|
public loggedIn :boolean = false;
|
||||||
|
|
||||||
// public static _REGION = environment.region;
|
// public static _REGION = environment.region;
|
||||||
|
|
||||||
// public static _IDENTITY_POOL_ID = environment.identityPoolId;
|
// public static _IDENTITY_POOL_ID = environment.identityPoolId;
|
||||||
@ -65,14 +66,16 @@ export class CognitoService implements CanActivateChild {
|
|||||||
// UserPoolId: CognitoService._USER_POOL_ID,
|
// UserPoolId: CognitoService._USER_POOL_ID,
|
||||||
// ClientId: CognitoService._CLIENT_ID
|
// ClientId: CognitoService._CLIENT_ID
|
||||||
// };
|
// };
|
||||||
|
|
||||||
get isLoggedIn() {
|
get isLoggedIn() {
|
||||||
if(sineedgedevUserpool.getCurrentUser() !=null){
|
if(sineedgeUserpool.getCurrentUser() !=null){
|
||||||
this.loggedIn = true;
|
this.loggedIn = true;
|
||||||
}else{
|
}else{
|
||||||
this.loggedIn = false;
|
this.loggedIn = false;
|
||||||
}
|
}
|
||||||
return this.loggedIn; // {2}
|
return this.loggedIn; // {2}
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivateChild(){
|
canActivateChild(){
|
||||||
if(this.getToken()){
|
if(this.getToken()){
|
||||||
//alert('session valid')
|
//alert('session valid')
|
||||||
@ -96,8 +99,7 @@ isloggin:boolean = false;
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
getCurrentUser() {
|
getCurrentUser() {
|
||||||
|
return sineedgeUserpool.getCurrentUser();
|
||||||
return sineedgedevUserpool.getCurrentUser();
|
|
||||||
}
|
}
|
||||||
constructor(public route:Router) { }
|
constructor(public route:Router) { }
|
||||||
|
|
||||||
|
|||||||
778
ng6-seed/src/app/AwsService_bkup/aws.service.ts
Executable file
778
ng6-seed/src/app/AwsService_bkup/aws.service.ts
Executable file
@ -0,0 +1,778 @@
|
|||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
import {
|
||||||
|
AuthenticationDetails,
|
||||||
|
CognitoUserPool,
|
||||||
|
CognitoUser,
|
||||||
|
CognitoUserAttribute,
|
||||||
|
ICognitoUserAttributeData,
|
||||||
|
ISignUpResult,
|
||||||
|
CognitoUserSession
|
||||||
|
} from "amazon-cognito-identity-js";
|
||||||
|
import * as AWS from "aws-sdk";
|
||||||
|
|
||||||
|
import { Observable } from "rxjs/Observable";
|
||||||
|
import "rxjs/add/operator/map";
|
||||||
|
// import AWS from "aws-sdk/dist/aws-sdk";
|
||||||
|
|
||||||
|
//environment
|
||||||
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
|
import { Http, Headers, RequestOptions } from '@angular/http';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import 'rxjs/add/operator/map';
|
||||||
|
import { CognitoService } from './cognito.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// const sineedge_poolData = {
|
||||||
|
// UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
|
||||||
|
// ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
|
||||||
|
// };
|
||||||
|
const sineedgedev_poolData = {
|
||||||
|
UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV
|
||||||
|
ClientId: "67b4fnbuols5upms5to8bvqddh"// ClientName: SINEEDGE_DEV_WEB
|
||||||
|
}
|
||||||
|
// client id changed on 12-04-2019 by kms
|
||||||
|
//ClientId: "2o5c3cs9k3als16nqhp3irh8rs"
|
||||||
|
|
||||||
|
const lender_poolData = {
|
||||||
|
UserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV
|
||||||
|
ClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName:LENDER_DEV_WEB
|
||||||
|
};
|
||||||
|
const vendor_poolData = {
|
||||||
|
UserPoolId: "ap-south-1_K57yPaWxV",
|
||||||
|
ClientId: ""
|
||||||
|
}
|
||||||
|
// const sineedgeUserPool = new CognitoUserPool(sineedge_poolData);
|
||||||
|
const lenderUserPool = new CognitoUserPool(lender_poolData);
|
||||||
|
const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identity PoolID
|
||||||
|
*/
|
||||||
|
const sineedgeIdentity = "ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";//"ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";
|
||||||
|
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
|
||||||
|
const vendorIdenttiy = "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874";
|
||||||
|
// serviceProvider
|
||||||
|
const apiurl = environment.apiEndpoint;
|
||||||
|
//const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
|
||||||
|
//const apiurl = "http://localhost/sparqapi/api/";
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: "root"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
export class AwsService {
|
||||||
|
//public static _REGION = environment.region;
|
||||||
|
mySecData: any;
|
||||||
|
|
||||||
|
cognitoUser: any;
|
||||||
|
jwttoken: any;
|
||||||
|
cognitousers: any;
|
||||||
|
localUserId:any = '';
|
||||||
|
constructor(public http: Http, public RequestOptions: RequestOptions,public shared:CognitoService) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login Function
|
||||||
|
* @param authenticationData inside of(email and password for login user)
|
||||||
|
* By sriram
|
||||||
|
*/
|
||||||
|
dologin(authenticationData) {
|
||||||
|
//(authenticationData);
|
||||||
|
const authenticationDetails = new AuthenticationDetails(authenticationData);
|
||||||
|
let Newpassword = authenticationData.newpassword;
|
||||||
|
let attributesData = [];
|
||||||
|
const userData = {
|
||||||
|
Username: authenticationData.Username, // User email id
|
||||||
|
Pool: sineedgedevUserpool // user Pool ID
|
||||||
|
};
|
||||||
|
let cognitoUser = new CognitoUser(userData);
|
||||||
|
return Observable.create(observer => {
|
||||||
|
cognitoUser.authenticateUser(authenticationDetails, {
|
||||||
|
newPasswordRequired: (userAttributes, requiredAttributes) => { // new password set
|
||||||
|
cognitoUser.completeNewPasswordChallenge(
|
||||||
|
Newpassword,
|
||||||
|
attributesData,
|
||||||
|
{
|
||||||
|
onSuccess: function (result) {
|
||||||
|
observer.next(result);
|
||||||
|
observer.complete();
|
||||||
|
},
|
||||||
|
onFailure: function (err) {
|
||||||
|
//(err);
|
||||||
|
observer.error(err);
|
||||||
|
//LoginComponent.prototype.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onSuccess: function (result) { // success user login
|
||||||
|
// let accessToken = result.getAccessToken().getJwtToken();
|
||||||
|
////(result);
|
||||||
|
//window.localStorage.setItem('Currentuser', '1');
|
||||||
|
observer.next(result);
|
||||||
|
observer.complete();
|
||||||
|
},
|
||||||
|
onFailure: function (err) { // error user login
|
||||||
|
|
||||||
|
alert(err.message);
|
||||||
|
observer.error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* End of the login function
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* User forget password
|
||||||
|
*/
|
||||||
|
userforgotpass(auth) {
|
||||||
|
////(auth);
|
||||||
|
const userData = {
|
||||||
|
Username: auth.Username,
|
||||||
|
Pool: sineedgedevUserpool
|
||||||
|
};
|
||||||
|
let cognitoUser = new CognitoUser(userData);
|
||||||
|
return Observable.create(observe => {
|
||||||
|
cognitoUser.forgotPassword({
|
||||||
|
onSuccess: function (data) {
|
||||||
|
// successfully initiated reset password request
|
||||||
|
//('CodeDeliveryData from forgotPassword: ' + data);
|
||||||
|
observe.next(data);
|
||||||
|
},
|
||||||
|
onFailure: function (err) {
|
||||||
|
alert(err.message || JSON.stringify(err));
|
||||||
|
},
|
||||||
|
//Optional automatic callback
|
||||||
|
inputVerificationCode: function (data) {
|
||||||
|
//('Code sent to: ' + data);
|
||||||
|
var verificationCode = prompt('Enter Verification Code Sent to Mobile ', '');
|
||||||
|
var newPassword = prompt('Enter New Password ', '');
|
||||||
|
cognitoUser.confirmPassword(verificationCode, newPassword, {
|
||||||
|
onSuccess() {
|
||||||
|
//('Password confirmed!');
|
||||||
|
},
|
||||||
|
onFailure(err) {
|
||||||
|
//('Password not confirmed!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* End of the function
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logout function
|
||||||
|
*/
|
||||||
|
logout(){
|
||||||
|
|
||||||
|
return Observable.create(observe=>{
|
||||||
|
this.shared.getCurrentUser().signOut();
|
||||||
|
|
||||||
|
observe.next();
|
||||||
|
|
||||||
|
observe.complete();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config function
|
||||||
|
*/
|
||||||
|
getconfig() {
|
||||||
|
let session:any = this.shared.getAccessToken() || "";
|
||||||
|
let config = "";
|
||||||
|
config += AWS.config.region = "ap-south-1";
|
||||||
|
config += AWS.config.credentials = new AWS.CognitoIdentityCredentials({
|
||||||
|
IdentityPoolId: sineedgeIdentity, // for sineedge_DEV
|
||||||
|
Logins: {
|
||||||
|
"cognito-idp.ap-south-1.amazonaws.com/ap-south-1_qQ85yQZJO": session
|
||||||
|
.getIdToken()
|
||||||
|
.getJwtToken()
|
||||||
|
}
|
||||||
|
// NOTE: getSession must be called to authenticate user before calling getUserAttributes
|
||||||
|
});
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* admin Disable user
|
||||||
|
* @param userdata
|
||||||
|
* @param awsName
|
||||||
|
*/
|
||||||
|
admindisabelUser(userdata, awsName) {
|
||||||
|
let session:any = this.shared.getAccessToken() || "";
|
||||||
|
this.getconfig();
|
||||||
|
// let config = "";
|
||||||
|
// AWS.config.region = "ap-south-1";//environment.region;
|
||||||
|
// AWS.config.credentials = new AWS.CognitoIdentityCredentials({
|
||||||
|
// IdentityPoolId: sineedgeIdentity, // for sineedge_DEV
|
||||||
|
// Logins: {
|
||||||
|
// "cognito-idp.ap-south-1.amazonaws.com/ap-south-1_qQ85yQZJO": session
|
||||||
|
// .getIdToken()
|
||||||
|
// .getJwtToken()
|
||||||
|
// }
|
||||||
|
// // NOTE: getSession must be called to authenticate user before calling getUserAttributes
|
||||||
|
// });
|
||||||
|
let userGroup = session.idToken.payload["cognito:groups"].filter(
|
||||||
|
usergroup => usergroup == "ADMIN"
|
||||||
|
)[0];
|
||||||
|
//cognitosdata = 7;
|
||||||
|
let params: any;
|
||||||
|
if (userGroup == 'ADMIN') {
|
||||||
|
if (userdata.fk_entity_type_id == 1) {
|
||||||
|
params = {
|
||||||
|
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
||||||
|
Username: awsName /* required */
|
||||||
|
};
|
||||||
|
} else if (userdata.fk_entity_type_id == 2) {
|
||||||
|
params = {
|
||||||
|
UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||||
|
Username: awsName /* required */
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Observable.create(observe => {
|
||||||
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
cognitoidentityserviceprovider.adminDisableUser(params, function (err, data) {
|
||||||
|
if (err) console.log(err, err.stack); // an error occurred
|
||||||
|
observe.next("0"); // successful response
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Admin enable user
|
||||||
|
* @param userdata
|
||||||
|
* @param awsName
|
||||||
|
*/
|
||||||
|
adminenableUser(userdata, awsName) {
|
||||||
|
let session:any = this.shared.getAccessToken() || "";
|
||||||
|
// this.getconfig();
|
||||||
|
let config = "";
|
||||||
|
AWS.config.region = "ap-south-1";
|
||||||
|
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
|
||||||
|
IdentityPoolId: sineedgeIdentity, // for sineedge_DEV
|
||||||
|
Logins: {
|
||||||
|
"cognito-idp.ap-south-1.amazonaws.com/ap-south-1_qQ85yQZJO": session
|
||||||
|
.getIdToken()
|
||||||
|
.getJwtToken()
|
||||||
|
}
|
||||||
|
// NOTE: getSession must be called to authenticate user before calling getUserAttributes
|
||||||
|
});
|
||||||
|
let userGroup = session.idToken.payload["cognito:groups"].filter(
|
||||||
|
usergroup => usergroup == "ADMIN"
|
||||||
|
)[0];
|
||||||
|
//cognitosdata = 7;
|
||||||
|
let params: any;
|
||||||
|
if (userGroup == 'ADMIN') {
|
||||||
|
|
||||||
|
if (userdata.fk_entity_type_id == 1) {
|
||||||
|
params = {
|
||||||
|
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
||||||
|
Username: awsName /* required */
|
||||||
|
};
|
||||||
|
} else if (userdata.fk_entity_type_id == 2) {
|
||||||
|
params = {
|
||||||
|
UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||||
|
Username: awsName /* required */
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Observable.create(observe => {
|
||||||
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
cognitoidentityserviceprovider.adminEnableUser(params, function (err, data) {
|
||||||
|
if (err) console.log(err, err.stack); // an error occurred
|
||||||
|
observe.next("1"); // successful response
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
register(userData) {
|
||||||
|
let session:any = this.shared.getAccessToken() || "";
|
||||||
|
|
||||||
|
this.getconfig();
|
||||||
|
let registeredData: any = "";
|
||||||
|
let params: any;
|
||||||
|
let userGroup = session.idToken.payload["cognito:groups"].filter(
|
||||||
|
usergroup => usergroup == "ADMIN"
|
||||||
|
)[0];
|
||||||
|
// (userGroup);
|
||||||
|
if (userGroup == "ADMIN") {
|
||||||
|
if (userData.type.entity_type_id == 1) {
|
||||||
|
params = {
|
||||||
|
UserPoolId: sineedgedev_poolData.UserPoolId /* required */,
|
||||||
|
Username: userData.email /* required */,
|
||||||
|
DesiredDeliveryMediums: [
|
||||||
|
"EMAIL"
|
||||||
|
/* more items */
|
||||||
|
],
|
||||||
|
// ForceAliasCreation: true || false,
|
||||||
|
MessageAction: "SUPPRESS",
|
||||||
|
TemporaryPassword: "temp1234",
|
||||||
|
UserAttributes: [
|
||||||
|
{
|
||||||
|
Name: "email" /* required */,
|
||||||
|
Value: userData.email
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "phone_number" /* required */,
|
||||||
|
Value: "+91" + userData.phone
|
||||||
|
},{
|
||||||
|
Name: "custom:role_id" /* required */,
|
||||||
|
Value: userData.role.role_id
|
||||||
|
}
|
||||||
|
/* more items */
|
||||||
|
]
|
||||||
|
};
|
||||||
|
} else if (userData.type.entity_type_id == 2) {
|
||||||
|
params = {
|
||||||
|
UserPoolId: lender_poolData.UserPoolId /* required */,
|
||||||
|
Username: userData.email /* required */,
|
||||||
|
DesiredDeliveryMediums: [
|
||||||
|
"EMAIL"
|
||||||
|
/* more items */
|
||||||
|
],
|
||||||
|
// ForceAliasCreation: true || false,
|
||||||
|
MessageAction: "SUPPRESS",
|
||||||
|
TemporaryPassword: "temp1234",
|
||||||
|
UserAttributes: [
|
||||||
|
{
|
||||||
|
Name: "email" /* required */,
|
||||||
|
Value: userData.email
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "phone_number" /* required */,
|
||||||
|
Value: "+91" + userData.phone
|
||||||
|
},{
|
||||||
|
Name: "custom:role_id" /* required */,
|
||||||
|
Value: userData.role.role_id
|
||||||
|
}
|
||||||
|
/* more items */
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}else if(userData.type.entity_type_id == 3){
|
||||||
|
params = {
|
||||||
|
UserPoolId: vendor_poolData.UserPoolId /* required */,
|
||||||
|
Username: userData.email /* required */,
|
||||||
|
DesiredDeliveryMediums: [
|
||||||
|
"EMAIL"
|
||||||
|
/* more items */
|
||||||
|
],
|
||||||
|
// ForceAliasCreation: true || false,
|
||||||
|
MessageAction: "SUPPRESS",
|
||||||
|
TemporaryPassword: "temp1234",
|
||||||
|
UserAttributes: [
|
||||||
|
{
|
||||||
|
Name: "email" /* required */,
|
||||||
|
Value: userData.email
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "phone_number" /* required */,
|
||||||
|
Value: "+91" + userData.phone
|
||||||
|
},{
|
||||||
|
Name: "custom:role_id" /* required */,
|
||||||
|
Value: userData.role.role_id
|
||||||
|
}
|
||||||
|
/* more items */
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Observable.create(observe => {
|
||||||
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
|
||||||
|
cognitoidentityserviceprovider.adminCreateUser(params, (
|
||||||
|
err,
|
||||||
|
data
|
||||||
|
) => {
|
||||||
|
if (err) { alert(err.message); }
|
||||||
|
// an error occurred
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
observe.next(data);
|
||||||
|
|
||||||
|
|
||||||
|
// successful response
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
return alert('Admin Only create user');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UserGroup(cognitodata, userData) {
|
||||||
|
//console.log(cognitodata);
|
||||||
|
this.getconfig();
|
||||||
|
//console.log(userData);
|
||||||
|
//let cognitodata = "539bfefa-ae42-4bee-bf79-4b15d1a2af7f";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let params: any;
|
||||||
|
|
||||||
|
if(userData.userid === undefined){
|
||||||
|
params = {
|
||||||
|
GroupName: "ADMIN" /* required */,
|
||||||
|
UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||||
|
Username: cognitodata.User.Username //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||||
|
};
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
params = {
|
||||||
|
GroupName: "ADMIN" /* required */,
|
||||||
|
UserPoolId: sineedgedev_poolData.UserPoolId,//"ap-south-1_y7dt3iEaX" /* required */,
|
||||||
|
Username: userData.aws_name //'539bfefa-ae42-4bee-bf79-4b15d1a2af7f' /* required */
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(params);
|
||||||
|
return Observable.create(observe=>{
|
||||||
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
|
||||||
|
cognitoidentityserviceprovider.adminAddUserToGroup(params, function (
|
||||||
|
err,
|
||||||
|
data
|
||||||
|
) {
|
||||||
|
if (err) {
|
||||||
|
alert(err.message);
|
||||||
|
}//(err, err.stack);
|
||||||
|
// an error occurred
|
||||||
|
else {//(data);
|
||||||
|
|
||||||
|
observe.next(cognitodata);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* admin User update
|
||||||
|
* @param username,clientid params
|
||||||
|
**/
|
||||||
|
adminUpdateuser(user, cognitosdata) {
|
||||||
|
let session:any = this.shared.getAccessToken() || "";
|
||||||
|
this.getconfig();
|
||||||
|
|
||||||
|
//let cognitodata = "539bfefa-ae42-4bee-bf79-4b15d1a2af7f";
|
||||||
|
let userGroup = session.idToken.payload["cognito:groups"].filter(
|
||||||
|
usergroup => usergroup == "ADMIN"
|
||||||
|
)[0];
|
||||||
|
//cognitosdata = 7;
|
||||||
|
let params:any;
|
||||||
|
if (userGroup == 'ADMIN') {
|
||||||
|
if(user.type.entity_type_id ==1){
|
||||||
|
params = {
|
||||||
|
UserAttributes: [ /* required */
|
||||||
|
{
|
||||||
|
Name: 'locale', /* required */
|
||||||
|
Value: cognitosdata.toString()
|
||||||
|
},{
|
||||||
|
Name:"email_verified",
|
||||||
|
Value:"true"
|
||||||
|
},{
|
||||||
|
Name:"phone_number_verified",
|
||||||
|
Value:"true"
|
||||||
|
}
|
||||||
|
/* more items */
|
||||||
|
],
|
||||||
|
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
||||||
|
Username: user.email /* required */
|
||||||
|
};
|
||||||
|
}else if(user.type.entity_type_id ==2){
|
||||||
|
params = {
|
||||||
|
UserAttributes: [ /* required */
|
||||||
|
{
|
||||||
|
Name: 'locale', /* required */
|
||||||
|
Value: cognitosdata.toString()
|
||||||
|
},{
|
||||||
|
Name:"email_verified",
|
||||||
|
Value:"true"
|
||||||
|
},{
|
||||||
|
Name:"phone_number_verified",
|
||||||
|
Value:"true"
|
||||||
|
}
|
||||||
|
/* more items */
|
||||||
|
],
|
||||||
|
UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||||
|
Username: user.email /* required */
|
||||||
|
};
|
||||||
|
}else if(user.type.entity_type_id ==3){
|
||||||
|
params = {
|
||||||
|
UserAttributes: [ /* required */
|
||||||
|
{
|
||||||
|
Name: 'locale', /* required */
|
||||||
|
Value: cognitosdata.toString()
|
||||||
|
},{
|
||||||
|
Name:"email_verified",
|
||||||
|
Value:"true"
|
||||||
|
},{
|
||||||
|
Name:"phone_number_verified",
|
||||||
|
Value:"true"
|
||||||
|
}
|
||||||
|
/* more items */
|
||||||
|
],
|
||||||
|
UserPoolId: vendor_poolData.UserPoolId, /* required */
|
||||||
|
Username: user.email /* required */
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//console.log(params);
|
||||||
|
return Observable.create(observe => {
|
||||||
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
|
||||||
|
cognitoidentityserviceprovider.adminUpdateUserAttributes(params, function (err, data) {
|
||||||
|
if (err) //(err, err.stack);
|
||||||
|
//console.log(data); // an error occurred
|
||||||
|
observe.next(data); // successful response
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getlocale(){
|
||||||
|
let session:any = this.shared.getAccessToken() || "";
|
||||||
|
return session.idToken.payload.locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
adminchangeData(userData,changeusers){
|
||||||
|
let session:any = this.shared.getAccessToken() || "";
|
||||||
|
this.getconfig();
|
||||||
|
let registeredData: any = "";
|
||||||
|
let params:any='';
|
||||||
|
let userGroup = session.idToken.payload["cognito:groups"].filter(
|
||||||
|
usergroup => usergroup == "ADMIN"
|
||||||
|
)[0];
|
||||||
|
// (userGroup);
|
||||||
|
if (userGroup == "ADMIN") {
|
||||||
|
if (userData.fk_entity_type_id == 1) {
|
||||||
|
params = {
|
||||||
|
UserPoolId: sineedgedev_poolData.UserPoolId /* required */,
|
||||||
|
Username: userData.aws_name,//userData.email /* required */,
|
||||||
|
|
||||||
|
// ForceAliasCreation: true || false,
|
||||||
|
|
||||||
|
UserAttributes: [
|
||||||
|
{
|
||||||
|
Name: "email" /* required */,
|
||||||
|
Value: changeusers.email,//userData.email
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "phone_number" /* required */,
|
||||||
|
Value: "+91"+ changeusers.phone
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "custom:role_id" /* required */,
|
||||||
|
Value: userData.user_role
|
||||||
|
},{
|
||||||
|
Name:"email_verified",
|
||||||
|
Value:"true"
|
||||||
|
},{
|
||||||
|
Name:"phone_number_verified",
|
||||||
|
Value:"true"
|
||||||
|
}
|
||||||
|
/* more items */
|
||||||
|
]
|
||||||
|
};
|
||||||
|
} else if (userData.fk_entity_type_id == 2) {
|
||||||
|
params = {
|
||||||
|
UserPoolId: lender_poolData.UserPoolId /* required */,
|
||||||
|
Username: userData.aws_name /* required */,
|
||||||
|
|
||||||
|
UserAttributes: [
|
||||||
|
{
|
||||||
|
Name: "email" /* required */,
|
||||||
|
Value: changeusers.email
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "phone_number" /* required */,
|
||||||
|
Value: "+91" + changeusers.phone
|
||||||
|
},{
|
||||||
|
Name: "custom:role_id" /* required */,
|
||||||
|
Value: userData.user_role
|
||||||
|
},{
|
||||||
|
Name:"email_verified",
|
||||||
|
Value:"true"
|
||||||
|
},{
|
||||||
|
Name:"phone_number_verified",
|
||||||
|
Value:"true"
|
||||||
|
}
|
||||||
|
/* more items */
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}else if(userData.fk_entity_type_id == 3)
|
||||||
|
{
|
||||||
|
params = {
|
||||||
|
UserPoolId: vendor_poolData.UserPoolId /* required */,
|
||||||
|
Username: userData.aws_name /* required */,
|
||||||
|
|
||||||
|
UserAttributes: [
|
||||||
|
{
|
||||||
|
Name: "email" /* required */,
|
||||||
|
Value: changeusers.email
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "phone_number" /* required */,
|
||||||
|
Value: "+91" + changeusers.phone
|
||||||
|
},{
|
||||||
|
Name: "custom:role_id" /* required */,
|
||||||
|
Value: userData.user_role
|
||||||
|
},{
|
||||||
|
Name:"email_verified",
|
||||||
|
Value:"true"
|
||||||
|
},{
|
||||||
|
Name:"phone_number_verified",
|
||||||
|
Value:"true"
|
||||||
|
}
|
||||||
|
/* more items */
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Observable.create(observe=>{
|
||||||
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
cognitoidentityserviceprovider.adminUpdateUserAttributes(params, function(err, data) {
|
||||||
|
if (err) console.log(err, err.stack); // an error occurred
|
||||||
|
observe.next(data); // successful response
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// adminremoveGroup(roles,users){
|
||||||
|
// console.log(roles);
|
||||||
|
// console.log(users);
|
||||||
|
// if(users !==undefined){
|
||||||
|
|
||||||
|
// let session:any = this.shared.getAccessToken() ||"";
|
||||||
|
// this.getconfig();
|
||||||
|
// let params:any;
|
||||||
|
// if(users.fk_entity_type_id ==1){
|
||||||
|
// params = {
|
||||||
|
// GroupName: roles.GroupName, /* required */
|
||||||
|
// UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
||||||
|
// Username: users.aws_name//'2c64866e-e96f-453b-903f-2b6f831688af' /* required */
|
||||||
|
// };
|
||||||
|
// }else if(users.fk_entity_id ==2){
|
||||||
|
// params = {
|
||||||
|
// GroupName: roles.GroupName, /* required */
|
||||||
|
// UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||||
|
// Username: users.aws_name//'2c64866e-e96f-453b-903f-2b6f831688af' /* required */
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
// cognitoidentityserviceprovider.adminRemoveUserFromGroup(params, function(err, data) {
|
||||||
|
// if (err) console.log(err, err.stack); // an error occurred
|
||||||
|
// else console.log(data); // successful response
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
adminresetpassword(awsuser){
|
||||||
|
this.getconfig();
|
||||||
|
let params:any;
|
||||||
|
if(awsuser.fk_entity_id ==1){
|
||||||
|
params= {
|
||||||
|
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
||||||
|
Username: awsuser.email /* required */
|
||||||
|
};
|
||||||
|
}else if(awsuser.fk_entity_id ==2){
|
||||||
|
params= {
|
||||||
|
UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||||
|
Username: awsuser.email /* required */
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Observable.create(observe=>{
|
||||||
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
cognitoidentityserviceprovider.changePassword(params, function(err, data) {
|
||||||
|
if (err) console.log(err, err.stack); // an error occurred
|
||||||
|
else {
|
||||||
|
observe.next(data);
|
||||||
|
} // successful response
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
changepassword(passData) {
|
||||||
|
let session:any = this.shared.getAccessToken() || "";
|
||||||
|
this.getconfig();
|
||||||
|
var params = {
|
||||||
|
AccessToken: session.accessToken.jwtToken, /* required */
|
||||||
|
PreviousPassword: passData.oldPassword, /* required */
|
||||||
|
ProposedPassword: passData.newPassword /* required */
|
||||||
|
};
|
||||||
|
return Observable.create(observe => {
|
||||||
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
cognitoidentityserviceprovider.changePassword(params, function (err, data) {
|
||||||
|
if (err) console.log(err, err.stack); // an error occurred
|
||||||
|
observe.next(data);
|
||||||
|
// successful response
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
admindelete(aws){
|
||||||
|
this.getconfig();
|
||||||
|
let params:any;
|
||||||
|
if(aws.fk_entity_id ==1){
|
||||||
|
params= {
|
||||||
|
UserPoolId: sineedgedev_poolData.UserPoolId, /* required */
|
||||||
|
Username: aws.email /* required */
|
||||||
|
};
|
||||||
|
}else if(aws.fk_entity_id ==2){
|
||||||
|
params= {
|
||||||
|
UserPoolId: lender_poolData.UserPoolId, /* required */
|
||||||
|
Username: aws.email /* required */
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Observable.create(observe=>{
|
||||||
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
cognitoidentityserviceprovider.adminDeleteUser(params, function(err, data) {
|
||||||
|
if (err) console.log(err, err.stack); // an error occurred
|
||||||
|
else {
|
||||||
|
observe.next(data);
|
||||||
|
} // successful response
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
adminlistgroup(enitiy){
|
||||||
|
// console.log(enitiy);
|
||||||
|
this.getconfig();
|
||||||
|
let params:any;
|
||||||
|
if(enitiy ==1){
|
||||||
|
params = {
|
||||||
|
UserPoolId:sineedgedev_poolData.UserPoolId,
|
||||||
|
}
|
||||||
|
}else if(enitiy ==2){
|
||||||
|
params = {
|
||||||
|
UserPoolId:lender_poolData.UserPoolId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//console.log(enitiy);
|
||||||
|
return Observable.create(observe=>{
|
||||||
|
|
||||||
|
let cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
|
||||||
|
cognitoidentityserviceprovider.listGroups(params,function(err,data){
|
||||||
|
if(err) alert(err.stack);
|
||||||
|
else {observe.next(data.Groups);}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
204
ng6-seed/src/app/AwsService_bkup/cognito.service.ts
Executable file
204
ng6-seed/src/app/AwsService_bkup/cognito.service.ts
Executable file
@ -0,0 +1,204 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import * as AWS from "aws-sdk";
|
||||||
|
import { CanActivateChild, Router } from '@angular/router';
|
||||||
|
import {
|
||||||
|
AuthenticationDetails,
|
||||||
|
CognitoUserPool,
|
||||||
|
CognitoUser,
|
||||||
|
CognitoUserAttribute,
|
||||||
|
ICognitoUserAttributeData,
|
||||||
|
ISignUpResult,
|
||||||
|
CognitoUserSession
|
||||||
|
} from "amazon-cognito-identity-js";
|
||||||
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
|
import { BehaviorSubject,Observable,of } from 'rxjs';
|
||||||
|
const sineedge_poolData = {
|
||||||
|
UserPoolId: "ap-south-1_y7dt3iEaX", //ap-south-1_qQ85yQZJO UserName :SPARQ_SINEEDGE_DEV
|
||||||
|
ClientId: "291qt4smn5pql6o8cc2hi201lj" // ClientName: SINEEDGE_DEV_WEB
|
||||||
|
};
|
||||||
|
const sineedgedev_poolData = {
|
||||||
|
UserPoolId: "ap-south-1_qQ85yQZJO", // UserName :SPARQ_SINEEDGE_DEV
|
||||||
|
ClientId: "67b4fnbuols5upms5to8bvqddh" // ClientName: SINEEDGE_DEV_WEB
|
||||||
|
}
|
||||||
|
const lender_poolData = {
|
||||||
|
UserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV
|
||||||
|
ClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName:LENDER_DEV_WEB
|
||||||
|
};
|
||||||
|
const vendor_poolData = {
|
||||||
|
UserPoolId: "",
|
||||||
|
ClientId: ""
|
||||||
|
}
|
||||||
|
const sineedgeUserPool = new CognitoUserPool(sineedge_poolData);
|
||||||
|
const lenderUserPool = new CognitoUserPool(lender_poolData);
|
||||||
|
const sineedgedevUserpool = new CognitoUserPool(sineedgedev_poolData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identity PoolID
|
||||||
|
*/
|
||||||
|
const sineedgeIdentity = "ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";//"ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961";
|
||||||
|
const lenderIdentity = "ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907";
|
||||||
|
const vendorIdenttiy = "";
|
||||||
|
// serviceProvider
|
||||||
|
//const apiurl = "http://ssa.sineedge.com/sparqapi/api/";
|
||||||
|
const apiurl = environment.apiEndpoint;
|
||||||
|
// const apiurl = "http://localhost/sparqapi/api/";
|
||||||
|
|
||||||
|
export interface Callback {
|
||||||
|
callback(): void;
|
||||||
|
|
||||||
|
callbackWithParam(result: any): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class CognitoService implements CanActivateChild {
|
||||||
|
public loggedIn :boolean = false;
|
||||||
|
// public static _REGION = environment.region;
|
||||||
|
|
||||||
|
// public static _IDENTITY_POOL_ID = environment.identityPoolId;
|
||||||
|
// public static _USER_POOL_ID = environment.UserPoolId;
|
||||||
|
// public static _CLIENT_ID = environment.ClientId;
|
||||||
|
|
||||||
|
// public static _POOL_DATA: any = {
|
||||||
|
// UserPoolId: CognitoService._USER_POOL_ID,
|
||||||
|
// ClientId: CognitoService._CLIENT_ID
|
||||||
|
// };
|
||||||
|
get isLoggedIn() {
|
||||||
|
if(sineedgedevUserpool.getCurrentUser() !=null){
|
||||||
|
this.loggedIn = true;
|
||||||
|
}else{
|
||||||
|
this.loggedIn = false;
|
||||||
|
}
|
||||||
|
return this.loggedIn; // {2}
|
||||||
|
}
|
||||||
|
canActivateChild(){
|
||||||
|
if(this.getToken()){
|
||||||
|
//alert('session valid')
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
this.route.navigate(['/authentication/login']);
|
||||||
|
//alert('session valid timeout');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public cognitoCreds: AWS.CognitoIdentityCredentials;
|
||||||
|
isloggin:boolean = false;
|
||||||
|
|
||||||
|
|
||||||
|
// getUserPool() {
|
||||||
|
// if (environment.cognito_idp_endpoint) {
|
||||||
|
// CognitoService.sineedgedev_poolData.endpoint = environment.cognito_idp_endpoint;
|
||||||
|
// }
|
||||||
|
// return new CognitoUserPool(CognitoService.sineedgedev_poolData);
|
||||||
|
// }
|
||||||
|
|
||||||
|
getCurrentUser() {
|
||||||
|
|
||||||
|
return sineedgedevUserpool.getCurrentUser();
|
||||||
|
}
|
||||||
|
constructor(public route:Router) { }
|
||||||
|
|
||||||
|
// getAccessToken(callback: Callback): void {
|
||||||
|
// if (callback == null) {
|
||||||
|
// throw("CognitoUtil: callback in getAccessToken is null...returning");
|
||||||
|
// }
|
||||||
|
// if (this.getCurrentUser() != null) {
|
||||||
|
// this.getCurrentUser().getSession(function (err, session) {
|
||||||
|
// if (err) {
|
||||||
|
// console.log("CognitoUtil: Can't set the credentials:" + err);
|
||||||
|
// callback.callbackWithParam(null);
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// if (session.isValid()) {
|
||||||
|
// console.log("62");
|
||||||
|
// callback.callbackWithParam(session.getAccessToken().getJwtToken());
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// callback.callbackWithParam(null);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
refresh() {
|
||||||
|
let tokenexp:boolean;
|
||||||
|
this.getCurrentUser().getSession(function (err, session) {
|
||||||
|
if (err) {
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
if (session.isValid()) {
|
||||||
|
tokenexp = session.isValid();
|
||||||
|
of(tokenexp)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
tokenexp = session.isValid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tokenexp;
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getAccessToken(){
|
||||||
|
this.refresh();
|
||||||
|
let jwttoken = '';
|
||||||
|
if (this.getCurrentUser() != null) {
|
||||||
|
//console.log(JSON.stringify(this.getCurrentUser()));
|
||||||
|
// console.log('76 if');
|
||||||
|
this.getCurrentUser().getSession(function (err, session) {
|
||||||
|
if (err) {
|
||||||
|
jwttoken ='';
|
||||||
|
// console.log('81 if')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (session.isValid()) {
|
||||||
|
// console.log('85 else if');
|
||||||
|
jwttoken = session;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//console.log("else");
|
||||||
|
|
||||||
|
}
|
||||||
|
return jwttoken;
|
||||||
|
}
|
||||||
|
|
||||||
|
getToken():boolean {
|
||||||
|
let isloggin = false;
|
||||||
|
if (this.getCurrentUser() != null) {
|
||||||
|
//console.log(JSON.stringify(this.getCurrentUser()));
|
||||||
|
//console.log('76 if');
|
||||||
|
this.getCurrentUser().getSession(function (err, session) {
|
||||||
|
if (err) {
|
||||||
|
// console.log("CognitoUtil: Can't set the credentials:" + err);
|
||||||
|
isloggin = false;
|
||||||
|
//console.log('81 if')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (session.isValid()) {
|
||||||
|
// console.log('85 else if');
|
||||||
|
isloggin = true;
|
||||||
|
} else {
|
||||||
|
isloggin = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// console.log("else");
|
||||||
|
isloggin = false;
|
||||||
|
}
|
||||||
|
return isloggin;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -12,6 +12,8 @@ import { Router } from '@angular/router';
|
|||||||
import { retry,catchError, map, tap } from 'rxjs/operators';
|
import { retry,catchError, map, tap } from 'rxjs/operators';
|
||||||
import { HttpErrorResponse } from "@angular/common/http";
|
import { HttpErrorResponse } from "@angular/common/http";
|
||||||
import { CognitoService } from '../AwsService/cognito.service';
|
import { CognitoService } from '../AwsService/cognito.service';
|
||||||
|
//environment
|
||||||
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TokenInterceptor implements HttpInterceptor{
|
export class TokenInterceptor implements HttpInterceptor{
|
||||||
@ -26,7 +28,7 @@ export class TokenInterceptor implements HttpInterceptor{
|
|||||||
//console.log(token);
|
//console.log(token);
|
||||||
let requests = request.clone({
|
let requests = request.clone({
|
||||||
headers:new HttpHeaders({
|
headers:new HttpHeaders({
|
||||||
'Authorization': 'sparqvenba2018',
|
'Authorization': environment.authorization,
|
||||||
'Token': token.getIdToken().getJwtToken()
|
'Token': token.getIdToken().getJwtToken()
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
48
ng6-seed/src/app/_guard_bkup/auth.guard.ts
Executable file
48
ng6-seed/src/app/_guard_bkup/auth.guard.ts
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild } from '@angular/router';
|
||||||
|
import { Observable , of } from 'rxjs';
|
||||||
|
import { CognitoService } from '../AwsService/cognito.service';
|
||||||
|
@Injectable()
|
||||||
|
export class AuthGuard implements CanActivate, CanActivateChild {
|
||||||
|
|
||||||
|
constructor(private router: Router,public shared:CognitoService) { }
|
||||||
|
|
||||||
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||||
|
if (this.shared.getToken()) {
|
||||||
|
alert("if");
|
||||||
|
// this.router.navigate(['']);
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
alert("else");
|
||||||
|
this.router.navigate(['/login']);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||||
|
|
||||||
|
if (this.shared.getToken()) {
|
||||||
|
// alert("if");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
// alert("else");
|
||||||
|
setTimeout(() => {
|
||||||
|
this.router.navigate(['authentication/login']);
|
||||||
|
return false;
|
||||||
|
},1000);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// public getToken(): string {
|
||||||
|
// return localStorage.getItem('token');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public logOut() {
|
||||||
|
// localStorage.clear();
|
||||||
|
// if(localStorage.getItem('token') === null){
|
||||||
|
// this.router.navigate(['/login']);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
91
ng6-seed/src/app/_guard_bkup/token.interceptor.ts
Executable file
91
ng6-seed/src/app/_guard_bkup/token.interceptor.ts
Executable file
@ -0,0 +1,91 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import {
|
||||||
|
HttpRequest,
|
||||||
|
HttpHandler,
|
||||||
|
HttpEvent,
|
||||||
|
HttpInterceptor,
|
||||||
|
HttpHeaders
|
||||||
|
} from '@angular/common/http';
|
||||||
|
// import { AuthGuard } from './auth.guard';
|
||||||
|
import { Observable, of, throwError } from 'rxjs';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { retry,catchError, map, tap } from 'rxjs/operators';
|
||||||
|
import { HttpErrorResponse } from "@angular/common/http";
|
||||||
|
import { CognitoService } from '../AwsService/cognito.service';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class TokenInterceptor implements HttpInterceptor{
|
||||||
|
constructor( private router: Router,public shared:CognitoService) {}
|
||||||
|
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
|
// request = request.clone({
|
||||||
|
// setHeaders: {
|
||||||
|
// Authorization: `${this.auth.getToken()}`
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
let token:any = this.shared.getAccessToken() ||"";
|
||||||
|
//console.log(token);
|
||||||
|
let requests = request.clone({
|
||||||
|
headers:new HttpHeaders({
|
||||||
|
'Authorization': 'sparqvenba2018',
|
||||||
|
'Token': token.getIdToken().getJwtToken()
|
||||||
|
})
|
||||||
|
});
|
||||||
|
return next.handle(requests).pipe(
|
||||||
|
catchError(this.handleError<any>('role', []))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// private handleError<T> (operation = 'operation', result?: T) {
|
||||||
|
// console.log(result);
|
||||||
|
// return (error: any): Observable<T> => {
|
||||||
|
// if(error instanceof HttpErrorResponse){
|
||||||
|
// console.error("Error: " + error.status);
|
||||||
|
// if(error.status == 401){
|
||||||
|
// localStorage.clear();
|
||||||
|
// this.router.navigate(['/authentication/login']);
|
||||||
|
// }
|
||||||
|
// return of(result as T);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
|
private handleError<T> (operation = 'operation', result?: T) {
|
||||||
|
return (error: any): Observable<T> => {
|
||||||
|
if(error instanceof HttpErrorResponse){
|
||||||
|
console.error("Error: " + error.status);
|
||||||
|
if(error.status == 401){
|
||||||
|
localStorage.clear();
|
||||||
|
this.router.navigate(['/authentication/login']);
|
||||||
|
}
|
||||||
|
else if(error.status == 404){
|
||||||
|
this.router.navigate(['/error/404']);
|
||||||
|
}
|
||||||
|
else if(error.status == 503){
|
||||||
|
this.router.navigate(['/error/503']);
|
||||||
|
}
|
||||||
|
else if(error.status == 0){
|
||||||
|
this.router.navigate(['/error/404']);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
let errorMessage = '';
|
||||||
|
let type : number;
|
||||||
|
if (error.error instanceof ErrorEvent) {
|
||||||
|
// client-side error
|
||||||
|
errorMessage = `Error: ${error.error.message}`;
|
||||||
|
type = 1;
|
||||||
|
} else {
|
||||||
|
// server-side error
|
||||||
|
errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`;
|
||||||
|
type = 2;
|
||||||
|
}
|
||||||
|
return throwError({error_status :type == 2 ? error.status : '',
|
||||||
|
error_message:error.message,
|
||||||
|
error_text :type == 2 ? error.statusText : '',
|
||||||
|
html_format :errorMessage,
|
||||||
|
error_type :type,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -694,11 +694,11 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.disableAfterSubmit = false;
|
this.disableAfterSubmit = false;
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Went Wrong Try Again.! \t\"' + result.status +'\" Error Occur.!');
|
||||||
}
|
}
|
||||||
}, error => {
|
}, err => {
|
||||||
this.disableAfterSubmit = false;
|
this.disableAfterSubmit = false;
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,7 +98,7 @@ export class AllPdComponent implements OnInit, OnChanges {
|
|||||||
// , error => {this.errorMessage = <any> error});
|
// , error => {this.errorMessage = <any> error});
|
||||||
,error => {
|
,error => {
|
||||||
this.errorMessage.push(error);
|
this.errorMessage.push(error);
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
alert(error.html_format);
|
alert(error.html_format);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ export class AllPdComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
},error => {
|
},error => {
|
||||||
this.errorMessage.push(error);
|
this.errorMessage.push(error);
|
||||||
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
alert(error.html_format);
|
alert(error.html_format);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,7 +101,7 @@ export class CompletedPdComponent implements OnInit, OnChanges {
|
|||||||
// , error => this.errorMessage = <any> error);
|
// , error => this.errorMessage = <any> error);
|
||||||
,error => {
|
,error => {
|
||||||
this.errorMessage.push(error);
|
this.errorMessage.push(error);
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
alert(error.html_format);
|
alert(error.html_format);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ export class CompletedPdComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
},error => {
|
},error => {
|
||||||
this.errorMessage.push(error);
|
this.errorMessage.push(error);
|
||||||
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
alert(error.html_format);
|
alert(error.html_format);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -265,7 +265,7 @@ export class EditPdApplicantComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.disableAfterSubmit = false;
|
this.disableAfterSubmit = false;
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,7 +96,7 @@ export class EditPdMasterComponent implements OnInit {
|
|||||||
//, error => this.errorMessage = <any> error);
|
//, error => this.errorMessage = <any> error);
|
||||||
, error => {
|
, error => {
|
||||||
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
selectedLender(lender){
|
selectedLender(lender){
|
||||||
@ -583,21 +583,21 @@ export class EditPdMasterComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.notifier.notify('success', 'PD Details Updated.');
|
this.notifier.notify('success', 'PD Details Updated.');
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!');
|
this.notifier.notify('warning', 'Something Went Wrong in Address Try Again.!');
|
||||||
}//else
|
}//else
|
||||||
}, error => {
|
}, error => {
|
||||||
// this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!');
|
// this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!');
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong in Address Section Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.disableAfterSubmit = false;
|
this.disableAfterSubmit = false;
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
|
||||||
}//else
|
}//else
|
||||||
}, error => {
|
}, error => {
|
||||||
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
this.disableAfterSubmit = false;
|
this.disableAfterSubmit = false;
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
});//error closed
|
});//error closed
|
||||||
}//else closed
|
}//else closed
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@ submitDetails(values: any) {
|
|||||||
},3000);
|
},3000);
|
||||||
}, error => {
|
}, error => {
|
||||||
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
// alert(error);
|
// alert(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,7 +94,7 @@ export class InprogressPdComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
},error => {
|
},error => {
|
||||||
this.errorMessage.push(error);
|
this.errorMessage.push(error);
|
||||||
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
alert(error.html_format);
|
alert(error.html_format);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,11 +70,11 @@ export class PdAllocationComponent implements OnInit {
|
|||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
|
||||||
this.errorMessage = "Something Wents Wrong Try Again.!";
|
this.errorMessage = "Something Went Wrong Try Again.!";
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
||||||
// this.dialogRef.close();
|
// this.dialogRef.close();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -90,7 +90,7 @@ export class ModelEditPdReportComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}, err => {
|
}, err => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,10 +101,10 @@ export class PdReportComponent implements OnInit {
|
|||||||
this.notifier.notify('success', 'Your Changes Updated.!');
|
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||||
this.getPdReportVersionList();
|
this.getPdReportVersionList();
|
||||||
} else {
|
} else {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
|
||||||
}
|
}
|
||||||
}, err => {
|
}, err => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
generateNewPDReport() {
|
generateNewPDReport() {
|
||||||
@ -116,10 +116,10 @@ export class PdReportComponent implements OnInit {
|
|||||||
this.notifier.notify('success', 'Your Changes Updated.!');
|
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||||
this.getPdReportVersionList();
|
this.getPdReportVersionList();
|
||||||
} else {
|
} else {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
|
||||||
}
|
}
|
||||||
}, err => {
|
}, err => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -90,7 +90,7 @@ export class QcReviewComponent implements OnInit {
|
|||||||
status: true
|
status: true
|
||||||
});
|
});
|
||||||
}, err => {
|
}, err => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,10 +85,10 @@ export class PdRequirementComponent implements OnInit {
|
|||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,11 +68,11 @@ export class PdStatusChangeDialogueComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.dialogRef.close({update_status:false});
|
this.dialogRef.close({update_status:false});
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.dialogRef.close({update_status:false});
|
this.dialogRef.close({update_status:false});
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,7 @@ export class QcCompletedPdComponent implements OnInit, OnChanges {
|
|||||||
// , error => this.errorMessage = <any>error);
|
// , error => this.errorMessage = <any>error);
|
||||||
,error => {
|
,error => {
|
||||||
this.errorMessage.push(error);
|
this.errorMessage.push(error);
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
alert(error.html_format);
|
alert(error.html_format);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ export class QcCompletedPdComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
},error => {
|
},error => {
|
||||||
this.errorMessage.push(error);
|
this.errorMessage.push(error);
|
||||||
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
alert(error.html_format);
|
alert(error.html_format);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,12 +96,12 @@ export class SchedulePdComponent implements OnInit, OnDestroy {
|
|||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Went Wrong Try Again.!');
|
||||||
this.errorMessage = "Something Wents Wrong Try Again.!";
|
this.errorMessage = "Something Went Wrong Try Again.!";
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
this.errorMessage = "Some Thing Went Wrong Try Again.!";
|
||||||
this.dialogRef.close();
|
this.dialogRef.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -210,7 +210,7 @@ export class ScheduledPdComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
},error => {
|
},error => {
|
||||||
this.errorMessage.push(error);
|
this.errorMessage.push(error);
|
||||||
this.notifier.notify('warning', 'Something Went Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
alert(error.html_format);
|
alert(error.html_format);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,11 +74,11 @@ export class SmartPdAllocationComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
this.errorMessage = "Something Wents Wrong Try Again.!";
|
this.errorMessage = "Something Went Wrong Try Again.!";
|
||||||
}
|
}
|
||||||
}, error => {
|
}, error => {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (error.error_type == 2 ? error.error_status + ' ( ' + error.error_text + ' ) ' : ' ( ' + error.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
this.errorMessage = "Some Thing Went Wrong Try Again.!";
|
||||||
// this.dialogRef.close();
|
// this.dialogRef.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -298,10 +298,10 @@
|
|||||||
<div *ngFor="let items of item.controls.service_products['controls']; let l=index"
|
<div *ngFor="let items of item.controls.service_products['controls']; let l=index"
|
||||||
[formGroupName]="l">
|
[formGroupName]="l">
|
||||||
<mat-card style="margin: 12px;">
|
<mat-card style="margin: 12px;">
|
||||||
<h6 style="margin: 12px;padding:10px !important;">Service Provided {{l+1}}</h6>
|
<h6 style="margin: 12px;padding:10px !important;">Service Provider {{l+1}}</h6>
|
||||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||||
<mat-form-field style="width: 45%">
|
<mat-form-field style="width: 45%">
|
||||||
<mat-select placeholder="Select the Service Provided" formControlName="service_provider_product_name">
|
<mat-select placeholder="Select the Service Provider" formControlName="service_provider_product_name">
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option *ngFor="let pm of m_suplierProducts[0]" [value]="pm.name">{{
|
<mat-option *ngFor="let pm of m_suplierProducts[0]" [value]="pm.name">{{
|
||||||
pm.name }}</mat-option>
|
pm.name }}</mat-option>
|
||||||
|
|||||||
@ -97,10 +97,10 @@ export class QcPdReportComponent implements OnInit {
|
|||||||
this.notifier.notify('success', 'Your Changes Updated.!');
|
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.! \t\"' + data.status +'\" Error Occur.!');
|
this.notifier.notify('warning', 'Something Went Wrong Try Again.! \t\"' + data.status +'\" Error Occur.!');
|
||||||
}
|
}
|
||||||
}, err => {
|
}, err => {
|
||||||
this.notifier.notify('error', 'Something Wents Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!');
|
this.notifier.notify('error', 'Something Went Wrong Try Again.! \t\"' + (err.error_type == 2 ? err.error_status + ' ( ' + err.error_text + ' ) ' : ' ( ' + err.error_text + ' ) ') +'\" Error Occur.!');
|
||||||
// alert(err.html_format);
|
// alert(err.html_format);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,13 @@ import { Injectable } from '@angular/core';
|
|||||||
import { AngularFireDatabase } from '@angular/fire/database';
|
import { AngularFireDatabase } from '@angular/fire/database';
|
||||||
import { AngularFireAuth } from '@angular/fire/auth';
|
import { AngularFireAuth } from '@angular/fire/auth';
|
||||||
import { AngularFireMessaging } from '@angular/fire/messaging';
|
import { AngularFireMessaging } from '@angular/fire/messaging';
|
||||||
import { mergeMapTo } from 'rxjs/operators';
|
import { mergeMapTo,catchError } from 'rxjs/operators';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { BehaviorSubject } from 'rxjs'
|
import { BehaviorSubject, Observable, of } from 'rxjs'
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
|
/** Environment */
|
||||||
|
import { environment } from 'environments/environment'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MessagingService {
|
export class MessagingService {
|
||||||
@ -14,7 +18,8 @@ export class MessagingService {
|
|||||||
constructor(
|
constructor(
|
||||||
private angularFireDB: AngularFireDatabase,
|
private angularFireDB: AngularFireDatabase,
|
||||||
private angularFireAuth: AngularFireAuth,
|
private angularFireAuth: AngularFireAuth,
|
||||||
private angularFireMessaging: AngularFireMessaging) {
|
private angularFireMessaging: AngularFireMessaging,
|
||||||
|
private http: HttpClient) {
|
||||||
this.angularFireMessaging.messaging.subscribe(
|
this.angularFireMessaging.messaging.subscribe(
|
||||||
(_messaging) => {
|
(_messaging) => {
|
||||||
_messaging.onMessage = _messaging.onMessage.bind(_messaging);
|
_messaging.onMessage = _messaging.onMessage.bind(_messaging);
|
||||||
@ -36,9 +41,20 @@ export class MessagingService {
|
|||||||
const data = {};
|
const data = {};
|
||||||
data[userId] = token
|
data[userId] = token
|
||||||
this.angularFireDB.object('fcmTokens/').update(data)
|
this.angularFireDB.object('fcmTokens/').update(data)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
let params = {"records":{ "fk_user_id":userId,"token":token,"client":"WEB"}};
|
||||||
|
this.updateNotificationToken(params).subscribe(
|
||||||
|
(data) => { console.log('success',data);},
|
||||||
|
(err) => { console.error('something wents wrong on update notify.', err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateNotificationToken(params): Observable<any> {
|
||||||
|
return this.http.post(environment.apiEndpoint + 'updateNotificationToken', params)
|
||||||
|
.pipe(catchError(() => of(null)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* request permission for notification from firebase cloud messaging
|
* request permission for notification from firebase cloud messaging
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,6 +1,24 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
apiEndpoint: 'https://ssa.sineedge.com/sparqtest/api/',
|
|
||||||
|
environmentName: 'Production Environment',//Live Environment.
|
||||||
|
|
||||||
|
apiEndpoint: 'https://pdgenie.com/sparqprod/api',
|
||||||
|
|
||||||
|
authorization: 'TnAwuc64pVpcB9xf',
|
||||||
|
|
||||||
|
seIdentityPoolId: 'ap-south-1:31774418-8384-4fbb-b3e2-b87ce0f26ef1',
|
||||||
|
seUserPoolId: 'ap-south-1_MlTee1O5V', // UserName
|
||||||
|
seClientId: '7sd1jutija6hkrq5m7tegf3mvq',// ClientName
|
||||||
|
|
||||||
|
lenIdentityPoolId:"ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907",
|
||||||
|
lenUserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV
|
||||||
|
lenClientId: "vkotfqgqorgjh3fvp1r26hslv", // ClientName:LENDER_DEV_WEB
|
||||||
|
|
||||||
|
venIdentityPoolId: "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874",
|
||||||
|
venUserPoolId: '',
|
||||||
|
venClientId: '',
|
||||||
|
|
||||||
firebase: {
|
firebase: {
|
||||||
apiKey: "AIzaSyCzmyM0WJ0wdLf8UsYoZ4GreICimyt7SEk",
|
apiKey: "AIzaSyCzmyM0WJ0wdLf8UsYoZ4GreICimyt7SEk",
|
||||||
authDomain: "ssa-push.firebaseapp.com",
|
authDomain: "ssa-push.firebaseapp.com",
|
||||||
@ -10,4 +28,5 @@ export const environment = {
|
|||||||
messagingSenderId: "627754063571",
|
messagingSenderId: "627754063571",
|
||||||
appId: "1:627754063571:web:8cfa56d80607267b"
|
appId: "1:627754063571:web:8cfa56d80607267b"
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
31
ng6-seed/src/environments/environment.stage.ts
Normal file
31
ng6-seed/src/environments/environment.stage.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
export const environment = {
|
||||||
|
production: true,
|
||||||
|
|
||||||
|
environmentName: 'Testing Environment',//Test Environment.
|
||||||
|
|
||||||
|
apiEndpoint: 'https://ssa.sineedge.com/sparqtest/api/',
|
||||||
|
|
||||||
|
authorization: 'sparqvenba2018',
|
||||||
|
|
||||||
|
seIdentityPoolId: 'ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961',
|
||||||
|
seUserPoolId: 'ap-south-1_qQ85yQZJO',
|
||||||
|
seClientId: '67b4fnbuols5upms5to8bvqddh',
|
||||||
|
|
||||||
|
lenIdentityPoolId:"ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907",
|
||||||
|
lenUserPoolId: "ap-south-1_hFiGyr1Gw", // Username :SPARQ_LENDER_DEV
|
||||||
|
lenClientId: "vkotfqgqorgjh3fvp1r26hslv", // ClientName:LENDER_DEV_WEB
|
||||||
|
|
||||||
|
venIdentityPoolId: "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874",
|
||||||
|
venUserPoolId: '',
|
||||||
|
venClientId: '',
|
||||||
|
|
||||||
|
firebase: {
|
||||||
|
apiKey: "AIzaSyCzmyM0WJ0wdLf8UsYoZ4GreICimyt7SEk",
|
||||||
|
authDomain: "ssa-push.firebaseapp.com",
|
||||||
|
databaseURL: "https://ssa-push.firebaseio.com",
|
||||||
|
projectId: "ssa-push",
|
||||||
|
storageBucket: "ssa-push.appspot.com",
|
||||||
|
messagingSenderId: "627754063571",
|
||||||
|
appId: "1:627754063571:web:8cfa56d80607267b"
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -5,7 +5,13 @@
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
|
|
||||||
|
environmentName: 'Development Environment',//Localhost Environment.
|
||||||
|
|
||||||
apiEndpoint: 'https://ssa.sineedge.com/sparqapi/api/',
|
apiEndpoint: 'https://ssa.sineedge.com/sparqapi/api/',
|
||||||
|
|
||||||
|
authorization: 'sparqvenba2018',
|
||||||
|
|
||||||
firebase: {
|
firebase: {
|
||||||
apiKey: "AIzaSyCzmyM0WJ0wdLf8UsYoZ4GreICimyt7SEk",
|
apiKey: "AIzaSyCzmyM0WJ0wdLf8UsYoZ4GreICimyt7SEk",
|
||||||
authDomain: "ssa-push.firebaseapp.com",
|
authDomain: "ssa-push.firebaseapp.com",
|
||||||
@ -18,9 +24,25 @@ export const environment = {
|
|||||||
|
|
||||||
region: 'ap-south-1',
|
region: 'ap-south-1',
|
||||||
|
|
||||||
identityPoolId: 'ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961',
|
// identityPoolId: 'ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961',
|
||||||
UserPoolId: 'ap-south-1_qQ85yQZJO',
|
// UserPoolId: 'ap-south-1_qQ85yQZJO',
|
||||||
ClientId: '2o5c3cs9k3als16nqhp3irh8rs',
|
// ClientId: '2o5c3cs9k3als16nqhp3irh8rs',
|
||||||
|
|
||||||
|
// lenClientId: "6egsdssf0i7h2o9mscqgqbn788" // ClientName
|
||||||
|
|
||||||
|
seIdentityPoolId: 'ap-south-1:9a551eab-97cf-4991-b677-2f9bcd058961',
|
||||||
|
seUserPoolId: 'ap-south-1_qQ85yQZJO',
|
||||||
|
seClientId: '67b4fnbuols5upms5to8bvqddh',
|
||||||
|
|
||||||
|
lenIdentityPoolId:"ap-south-1:ca22dabc-db59-4af5-9bb8-265f7ec95907",
|
||||||
|
lenUserPoolId: "ap-south-1_hFiGyr1Gw", // Username
|
||||||
|
lenClientId: "vkotfqgqorgjh3fvp1r26hslv", // ClientName
|
||||||
|
|
||||||
|
|
||||||
|
venIdentityPoolId: "ap-south-1:5ad3ce43-4260-4273-87b2-e6a377b8e874",
|
||||||
|
venUserPoolId: '',
|
||||||
|
venClientId: '',
|
||||||
|
|
||||||
|
|
||||||
rekognitionBucket: '',
|
rekognitionBucket: '',
|
||||||
albumName: "",
|
albumName: "",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user