-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(event): allow editing event organizers together with the event. …
…Fixes MEMB-710
- Loading branch information
1 parent
b37a8b5
commit d299d83
Showing
6 changed files
with
123 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const request = require('request-promise-native'); | ||
|
||
const config = require('../config'); | ||
|
||
module.exports.fetchUser = async (user, token) => { | ||
const userRequest = await request({ | ||
url: config.core.url + ':' + config.core.port + '/members/' + user.user_id, | ||
method: 'GET', | ||
headers: { | ||
'X-Requested-With': 'XMLHttpRequest', | ||
'X-Auth-Token': token, | ||
}, | ||
simple: false, | ||
json: true | ||
}); | ||
|
||
if (typeof userRequest !== 'object') { | ||
throw new Error('Malformed response when fetching user: ' + userRequest); | ||
} | ||
|
||
if (!userRequest.success) { | ||
throw new Error('Error fetching user: ' + JSON.stringify(userRequest)); | ||
} | ||
|
||
return { | ||
user_id: user.user_id, | ||
comment: user.comment, | ||
first_name: userRequest.data.first_name, | ||
last_name: userRequest.data.last_name | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.