Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit 508180c

Browse files
authored
Merge pull request #81 from FlowzPlatform/issue-subscription-invitation
Issue subscription invitation
2 parents e7423cc + a3c68db commit 508180c

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

service/src/services/invite/invite.class.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let SendEmailBodyInvite = emailTemp.sendInviteemail;
1111
let SendEmailBodyDecline = emailTemp.sendDeclineemail;
1212

1313
let domainKey = process.env.domainKey;
14-
let baseUrl = 'http://api.'+ domainKey;
14+
let baseUrl = 'https://api.'+ domainKey;
1515

1616
let schemaName = {
1717
'properties': {
@@ -95,13 +95,15 @@ class Service {
9595
// previous_packages[subscriptionId].role = _.omit(previous_packages[subscriptionId].role, Role1);
9696
}
9797
/* eslint-disable no-undef */
98-
axios.put(baseUrl+'/user/updateuserdetails/' + userId, { package: previous_packages }, { headers: { 'Authorization': apiHeaders.authorization } }).then(async ((result) => {
98+
/* eslint-disable */
99+
axios.put(baseUrl+'/user/updateuserdetails/' + userId, { package: previous_packages }, { headers: { 'Authorization': apiHeaders.authorization } })
100+
.then(async ((result) => {
99101
if (result.data.code == 201) {
100102
let subscription_invite = await (self.subscription_invitation(data , res ));
101103
self.sendEmail(data, res);
102104
}
103105
resolve(result.data);
104-
}).catch((err) => {
106+
})).catch((err) => {
105107
let errorObj = {};
106108
if(apiHeaders.authorization == undefined) {
107109
errorObj.statusText = 'missing Authorization header';
@@ -115,7 +117,7 @@ class Service {
115117
resolve (errorObj);
116118
}
117119
/* eslint-disable no-undef */
118-
}));
120+
});
119121
})).catch((err) => {
120122
let errorObj = {};
121123
errorObj.statusText = 'Not Found';

service/src/services/subscription-invitation/subscription-invitation.hooks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function before_create(hook) {
5050
}
5151

5252
let before_find = async((hook) => {
53-
let res = await (this.validateUser(hook));
53+
let res = await (validateUser(hook));
5454
if (res.code == 401) {
5555
throw new errors.NotAuthenticated('Invalid token');
5656
} else {
@@ -71,7 +71,7 @@ let before_find = async((hook) => {
7171
}
7272
});
7373

74-
async (function validateUser(data) { // eslint-disable-line no-unused-vars
74+
let validateUser = (data) => { // eslint-disable-line no-unused-vars
7575
return new Promise((resolve, reject) => { // eslint-disable-line no-unused-vars
7676
axios.get('http://api.' + process.env.domainKey +'/auth/api/userdetails', {
7777
strictSSL: false,
@@ -85,7 +85,7 @@ async (function validateUser(data) { // eslint-disable-line no-unused-vars
8585
resolve({ 'code': 401 });
8686
});
8787
});
88-
});
88+
};
8989

9090

9191
function before_patch(hook) {

0 commit comments

Comments
 (0)