You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
917 B
Vue

<template>
<div>
<h2>Browse Threads</h2>
<div class="card card-body" v-for="thread in threads" v-bind:key="thread.id">
<p>{{ thread.creator.name }}
<a href="./test/{ {{ thread.id }} }"><h3>{{ thread.thread_title }}</h3></a>
</div>
</div>
</template>
<script>
export default {
data() {
return {
threads: [],
thread: {
id: '',
thread_title: '',
creator: {
name: ''
},
},
thread_id: '',
edit: false
}
},
created() {
this.fetchThreads();
},
methods: {
fetchThreads() {
fetch("api/threads")
.then(res => res.json())
.then(res => {
this.threads = res.data;
});
}
}
}
</script>