How do I properly retrieve and display an array using axios.get in Vue? The data is not showing up in my table cells when I use the v-for directive. Could the issue be related to the v-for statement?
<tr v-for="params in form" :key="params">
<td>{{params.title}}</td>
<td>{{params.company}}</td>
<td>{{params.company_url}}</td>
<td>{{params.location}}</td>
<td>{{params.description}}</td>
<td>{{params.date_posted}}</td>
</tr>
<script setup>
import axios from 'axios';
import { useRouter } from 'vue-router';
axios.get("API_URL/list",{
params: {
title: "",
company: "",
company_url: "",
location: "",
description: "",
date_posted: "",
}
})
.then((res)=>{
console.log(res.data)
return res.data
})
Is it correct to use axios.post to submit form data with parameters? Are there any improvements needed in how the data is being sent through this method?
const state = reactive({
form: {
title: "",
company: "",
company_url: "",
location: "",
description: "",
date_posted: ""
},
});
const formCreate = async () => {
const postdata = {
title: state.form.title,
company: state.form.company,
company_url: state.form.company_url,
location: state.form.location,
description: state.form.description,
date_posted: state.form.date_posted,
};