Skip to content

Commit 3842b5a

Browse files
author
Jeffrey Biles
committed
Use axios because it does the correct PUT format by default
1 parent 285cc2c commit 3842b5a

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

db.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"body": "Newsletter Issue #161",
3535
"sentAt": "2020-03-24T18:25:43.511Z",
3636
"archived": false,
37-
"read": false
37+
"read": true
3838
}
3939
]
4040
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"lint": "vue-cli-service lint"
99
},
1010
"dependencies": {
11+
"axios": "^0.19.2",
1112
"core-js": "^3.6.4",
1213
"date-fns": "^2.11.0",
1314
"marked": "^0.8.1",

src/components/MailScreen.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
import MailScreenArchived from '@/components/MailScreenArchived.vue';
99
import MailScreenInbox from '@/components/MailScreenInbox.vue';
1010
import { ref } from 'vue';
11+
import axios from 'axios';
1112
1213
export default {
1314
async setup(){
14-
let response = await fetch('http://localhost:3000/emails');
15-
let emails = await response.json();
16-
emails = ref(emails);
15+
let {data} = await axios.get('http://localhost:3000/emails');
16+
let emails = ref(data);
1717
1818
return {emails};
1919
},

src/components/MailTable.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import MailView from '@/components/MailView.vue';
3232
import ModalView from '@/components/ModalView.vue';
3333
import { ref } from 'vue';
34+
import axios from 'axios';
3435
3536
export default {
3637
setup({emails}){
@@ -42,6 +43,7 @@
4243
4344
if(email) {
4445
openedEmail.value.read = true;
46+
axios.put(`http://localhost:3000/emails/${openedEmail.value.id}`, openedEmail.value)
4547
}
4648
}
4749

yarn.lock

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,13 @@ aws4@^1.8.0:
15841584
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.1.tgz#7e33d8f7d449b3f673cd72deb9abdc552dbe528e"
15851585
integrity sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==
15861586

1587+
axios@^0.19.2:
1588+
version "0.19.2"
1589+
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
1590+
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==
1591+
dependencies:
1592+
follow-redirects "1.5.10"
1593+
15871594
babel-loader@^8.0.6:
15881595
version "8.0.6"
15891596
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.6.tgz#e33bdb6f362b03f4bb141a0c21ab87c501b70dfb"
@@ -2640,6 +2647,13 @@ [email protected], debug@^2.2.0, debug@^2.3.3:
26402647
dependencies:
26412648
ms "2.0.0"
26422649

2650+
debug@=3.1.0:
2651+
version "3.1.0"
2652+
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
2653+
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
2654+
dependencies:
2655+
ms "2.0.0"
2656+
26432657
debug@^3.0.0, debug@^3.1.1, debug@^3.2.5:
26442658
version "3.2.6"
26452659
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
@@ -3358,6 +3372,13 @@ flush-write-stream@^1.0.0:
33583372
inherits "^2.0.3"
33593373
readable-stream "^2.3.6"
33603374

3375+
3376+
version "1.5.10"
3377+
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
3378+
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
3379+
dependencies:
3380+
debug "=3.1.0"
3381+
33613382
follow-redirects@^1.0.0:
33623383
version "1.10.0"
33633384
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.10.0.tgz#01f5263aee921c6a54fb91667f08f4155ce169eb"

0 commit comments

Comments
 (0)