-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheventBriteApi.js
More file actions
40 lines (32 loc) · 845 Bytes
/
eventBriteApi.js
File metadata and controls
40 lines (32 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const axios = require('../../node_modules/axios');
function getAll() {
// ... removing for brevity
}
function getById(id) {
const url = 'https://www.eventbriteapi.com/v3/events/' + id + '/';
const config = {
method: 'get',
headers: {
'Authorization': 'Bearer ' + process.env.EVENTBRITE_KEY
}
}
return axios(url, config)
.then(responseSuccessHandler)
.catch(responseErrorHandler);
}
function create(data) {
// ... removing for brevity
}
function update(id, data) {
// ... removing for brevity
}
function deleteEvent(id) {
// ... removing for brevity
}
const responseSuccessHandler = response => {
// ... removing for brevity
};
const responseErrorHandler = error => {
// ... removing for brevity
};
module.exports = { getAll, getById, create, update, deleteEvent };