diff --git a/src/api/src/db/request.js b/src/api/src/db/request.js
index 6a4406f..bec77b8 100644
--- a/src/api/src/db/request.js
+++ b/src/api/src/db/request.js
@@ -77,7 +77,8 @@ export default function (pool) {
(await pool.query(`${currentRequestSql}
WHERE "userId" = $1
AND "lastStatus" = 'Answered'
- ORDER BY "asOf" DESC`)).rows,
+ ORDER BY "asOf" DESC`,
+ [ userId ])).rows,
/**
* Get the "current" version of a request by its Id
diff --git a/src/api/src/routes/request.js b/src/api/src/routes/request.js
index 8682ee6..cbea3e4 100644
--- a/src/api/src/routes/request.js
+++ b/src/api/src/routes/request.js
@@ -47,6 +47,7 @@ export default function (checkJwt) {
})
.get('/answered', checkJwt, async (ctx, next) => {
ctx.body = await db.request.answered(ctx.state.user.sub)
+ ctx.response.status = 200
await next()
})
diff --git a/src/app/src/components/Answered.vue b/src/app/src/components/Answered.vue
index 491744c..e962ff6 100644
--- a/src/app/src/components/Answered.vue
+++ b/src/app/src/components/Answered.vue
@@ -1,18 +1,30 @@
article
+ page-title(title='Answered Requests')
p(v-if='!loaded') Loading answered requests...
div(v-if='loaded')
+ p(v-for='req in requests')
+ b-btn(@click='showFull(req.requestId)' size='sm' variant='outline-secondary')
+ icon(name='search')
+ | View Full Request
+ | {{ req.text }}
+ full-request(:events='eventBus')
diff --git a/src/app/src/components/Journal.vue b/src/app/src/components/Journal.vue
index 046835d..990b646 100644
--- a/src/app/src/components/Journal.vue
+++ b/src/app/src/components/Journal.vue
@@ -21,7 +21,7 @@ article
import Vue from 'vue'
import { mapState } from 'vuex'
-import _ from 'lodash'
+import chunk from 'lodash/chunk'
import EditRequest from './request/EditRequest'
import FullRequest from './request/FullRequest'
@@ -48,7 +48,7 @@ export default {
return `${this.user.given_name}'s Prayer Journal`
},
journalCardRows () {
- return _.chunk(this.journal, 3)
+ return chunk(this.journal, 3)
},
toast () {
return this.$parent.$refs.toast
diff --git a/src/app/src/components/Navigation.vue b/src/app/src/components/Navigation.vue
index df53f3f..1106f1d 100644
--- a/src/app/src/components/Navigation.vue
+++ b/src/app/src/components/Navigation.vue
@@ -1,5 +1,5 @@
-b-navbar(toggleable='sm' type='dark' variant='info' fixed='top')
+b-navbar(toggleable='sm' type='dark' variant='primary' fixed='top')
b-nav-toggle(target='nav_collapse')
b-navbar-brand(to='/')
span(style='font-weight:100;') my
diff --git a/src/app/src/components/request/FullRequest.vue b/src/app/src/components/request/FullRequest.vue
index 53fd488..30feda8 100644
--- a/src/app/src/components/request/FullRequest.vue
+++ b/src/app/src/components/request/FullRequest.vue
@@ -1,6 +1,5 @@
span
- b-btn(@click='openDialog()' title='Show History' size='sm' variant='outline-secondary'): icon(name='search')
b-modal(title='Prayer Request History'
v-model='historyVisible'
size='lg'
diff --git a/src/app/src/router/index.js b/src/app/src/router/index.js
index 7000677..0ada814 100644
--- a/src/app/src/router/index.js
+++ b/src/app/src/router/index.js
@@ -1,6 +1,7 @@
import Vue from 'vue'
import Router from 'vue-router'
+import Answered from '@/components/Answered'
import Home from '@/components/Home'
import Journal from '@/components/Journal'
import LogOn from '@/components/user/LogOn'
@@ -11,6 +12,7 @@ export default new Router({
mode: 'history',
routes: [
{ path: '/', name: 'Home', component: Home },
+ { path: '/answered', name: 'Answered', component: Answered },
{ path: '/journal', name: 'Journal', component: Journal },
{ path: '/user/log-on', name: 'LogOn', component: LogOn }
]
diff --git a/src/app/src/store/index.js b/src/app/src/store/index.js
index 9e8a66b..d98248b 100644
--- a/src/app/src/store/index.js
+++ b/src/app/src/store/index.js
@@ -33,7 +33,12 @@ const logError = function (error) {
export default new Vuex.Store({
state: {
user: JSON.parse(localStorage.getItem('user_profile') || '{}'),
- isAuthenticated: this.auth0.isAuthenticated(),
+ isAuthenticated: (() => {
+ if (this.auth0.isAuthenticated()) {
+ api.setBearer(localStorage.getItem('id_token'))
+ }
+ return this.auth0.isAuthenticated()
+ })(),
journal: {},
isLoadingJournal: false
},