Skip to content
Snippets Groups Projects
Commit 4235e9e9 authored by Trirst's avatar Trirst
Browse files

Update request to upload image.

parent 941ef68f
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@
</template>
<script>
import { mapActions } from "vuex";
import { mapActions, mapState } from "vuex";
export default {
data: () => {
return {
......@@ -34,6 +34,7 @@ export default {
noImage: function () {
return !this.imageList;
},
...mapState(["stateSecret"]),
},
methods: {
updateImageList() {
......@@ -57,7 +58,14 @@ export default {
},
async postImage(fd) {
try {
const response = await fetch("api/image", { method: "POST", body: fd });
const options = {
method: "POST",
headers: {
secret: this.stateSecret,
},
body: fd,
};
const response = await fetch("api/image", options);
const data = await response.json();
console.log(data);
this.addStateHashArray(data.hash);
......
<template>
<div id="home-container">
<section id="user-section">
<div>
<TagCreation></TagCreation>
<ImageUpload @image-submitted="updateHashArray"></ImageUpload>
<router-link id="user-settings" to="/user">User settings</router-link>
</div>
</section>
<ImageList :hashArray="stateHashArray"></ImageList>
</div>
......@@ -45,7 +47,7 @@ export default {
#user-section {
display: flex;
flex-flow: column;
position: fixed;
position: sticky;
height: 100vh;
}
#home-container {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment