Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit b0b478b

Browse files
committed
cleanup and included journal id as meta data for post when submitting
1 parent 563d01e commit b0b478b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/components/AllPosts.vue

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
<div>
33

44
<h1>Your Posts</h1>
5+
6+
<div class="dev-stuff">
7+
Journal ID: {{this.$route.params.id}}
8+
</div>
9+
510
<div id="posts-container">
611
<PostCard
712
v-for="(item, index) in this.allPosts"
813
:key="index"
9-
:card-data="item.data"/>
14+
:card-data="item"/>
1015
</div>
1116

1217
<h2>Add A New Post</h2>
@@ -21,7 +26,7 @@
2126
</template>
2227

2328
<script>
24-
import {addPost , getPosts, test} from "../models/PostsModel"
29+
import {addPost , getPosts} from "../models/PostsModel"
2530
import PostCard from "./PostCard"
2631
2732
export default {
@@ -44,7 +49,7 @@ export default {
4449
*/
4550
submit() {
4651
console.log("Post Submitted", this.post)
47-
addPost(this.post)
52+
addPost(this.post , this.$route.params.id)
4853
.then(resp => {
4954
alert(resp.message)
5055
console.log(resp)
@@ -57,13 +62,11 @@ export default {
5762
},
5863
beforeMount () {
5964
60-
getPosts()
65+
getPosts(this.$route.params.id)
6166
.then(resp => {
62-
console.log("data from DB", resp)
63-
this.allPosts = resp
67+
console.log("posts data from DB", resp)
68+
this.allPosts = resp.data
6469
})
65-
66-
test()
6770
},
6871
};
6972

0 commit comments

Comments
 (0)