mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-21 14:55:00 +00:00
Use axios because it does the correct PUT format by default
This commit is contained in:
@@ -8,12 +8,12 @@
|
||||
import MailScreenArchived from '@/components/MailScreenArchived.vue';
|
||||
import MailScreenInbox from '@/components/MailScreenInbox.vue';
|
||||
import { ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
|
||||
export default {
|
||||
async setup(){
|
||||
let response = await fetch('http://localhost:3000/emails');
|
||||
let emails = await response.json();
|
||||
emails = ref(emails);
|
||||
let {data} = await axios.get('http://localhost:3000/emails');
|
||||
let emails = ref(data);
|
||||
|
||||
return {emails};
|
||||
},
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
import MailView from '@/components/MailView.vue';
|
||||
import ModalView from '@/components/ModalView.vue';
|
||||
import { ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
|
||||
export default {
|
||||
setup({emails}){
|
||||
@@ -42,6 +43,7 @@
|
||||
|
||||
if(email) {
|
||||
openedEmail.value.read = true;
|
||||
axios.put(`http://localhost:3000/emails/${openedEmail.value.id}`, openedEmail.value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user