Proof of concept on API calls...

...remains unproven.
This commit is contained in:
Daniel J. Summers
2017-08-06 23:17:08 -05:00
parent 5a7a74c167
commit 15947abcbf
9 changed files with 135 additions and 51 deletions
-9
View File
@@ -1,9 +0,0 @@
import axios from 'axios'
const http = axios.create({
baseURL: 'http://localhost:8084'
})
export default {
something: http.get('/blah')
}
+28
View File
@@ -0,0 +1,28 @@
import axios from 'axios'
const http = axios.create({
baseURL: 'http://localhost:8084/api'
})
/**
* API access for myPrayerJournal
*/
export default {
/**
* Set the bearer token for all future requests
* @param {string} token The token to use to identify the user to the server
*/
setBearer: token => { http.defaults.headers.common['Authentication'] = `Bearer ${token}` },
/**
* Remove the bearer token
*/
removeBearer: () => delete http.defaults.headers.common['Authentication'],
/**
* Get all prayer requests and their most recent updates
*/
journal: () => http.get('/journal')
}