Looks promising
The proof of concept has been proven
This commit is contained in:
@@ -4,8 +4,8 @@ var path = require('path')
|
||||
module.exports = {
|
||||
build: {
|
||||
env: require('./prod.env'),
|
||||
index: path.resolve(__dirname, '../../api/wwwroot/index.html'),
|
||||
assetsRoot: path.resolve(__dirname, '../../api/wwwroot'),
|
||||
index: path.resolve(__dirname, '../../api/public/index.html'),
|
||||
assetsRoot: path.resolve(__dirname, '../../api/public'),
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
productionSourceMap: true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from 'axios'
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: 'http://localhost:8084/api'
|
||||
baseURL: 'http://localhost:3000/api/'
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -13,16 +13,16 @@ 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}` },
|
||||
setBearer: token => { http.defaults.headers.common['authorization'] = `Bearer ${token}` },
|
||||
|
||||
/**
|
||||
* Remove the bearer token
|
||||
*/
|
||||
removeBearer: () => delete http.defaults.headers.common['Authentication'],
|
||||
removeBearer: () => delete http.defaults.headers.common['authorization'],
|
||||
|
||||
/**
|
||||
* Get all prayer requests and their most recent updates
|
||||
*/
|
||||
journal: () => http.get('/journal')
|
||||
journal: () => http.get('journal/')
|
||||
|
||||
}
|
||||
|
||||
@@ -41,10 +41,12 @@ export default new Vuex.Store({
|
||||
[types.USER_LOGGED_ON] (state, user) {
|
||||
localStorage.setItem('user_profile', JSON.stringify(user))
|
||||
state.user = user
|
||||
api.setBearer(localStorage.getItem('id_token'))
|
||||
state.isAuthenticated = true
|
||||
},
|
||||
[types.USER_LOGGED_OFF] (state) {
|
||||
state.user = {}
|
||||
api.removeBearer()
|
||||
state.isAuthenticated = false
|
||||
},
|
||||
[types.LOADING_JOURNAL] (state, flag) {
|
||||
@@ -58,10 +60,11 @@ export default new Vuex.Store({
|
||||
[actions.LOAD_JOURNAL] ({ commit }) {
|
||||
commit(types.LOADED_JOURNAL, {})
|
||||
commit(types.LOADING_JOURNAL, true)
|
||||
api.setBearer(localStorage.getItem('id_token'))
|
||||
api.journal()
|
||||
.then(jrnl => {
|
||||
commit(types.LOADING_JOURNAL, false)
|
||||
commit(types.LOADED_JOURNAL, jrnl)
|
||||
commit(types.LOADED_JOURNAL, jrnl.data)
|
||||
})
|
||||
.catch(err => {
|
||||
commit(types.LOADING_JOURNAL, false)
|
||||
|
||||
Reference in New Issue
Block a user