cleanup api use
This commit is contained in:
@@ -48,7 +48,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { searchForWine } from "@/api";
|
import { searchForWine, requestNewWine } from "@/api";
|
||||||
import Wine from "@/ui/Wine";
|
import Wine from "@/ui/Wine";
|
||||||
import Modal from "@/ui/Modal";
|
import Modal from "@/ui/Modal";
|
||||||
|
|
||||||
@@ -84,19 +84,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
request(wine){
|
request(wine){
|
||||||
const options = {
|
requestNewWine(wine)
|
||||||
body: JSON.stringify({
|
|
||||||
wine: wine
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
method: "post"
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch("http://localhost:30030/api/request/new-wine", options)
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(() => this.showModal = true)
|
.then(() => this.showModal = true)
|
||||||
},
|
},
|
||||||
emitFromModalButton(action){
|
emitFromModalButton(action){
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { deleteRequestedWine } from "@/api";
|
import { deleteRequestedWine, requestNewWine } from "@/api";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data(){
|
data(){
|
||||||
@@ -46,18 +46,7 @@ export default {
|
|||||||
request(wine){
|
request(wine){
|
||||||
this.locallyRequested = true
|
this.locallyRequested = true
|
||||||
this.requestedElement.count = this.requestedElement.count +1
|
this.requestedElement.count = this.requestedElement.count +1
|
||||||
const options = {
|
requestNewWine(wine)
|
||||||
body: JSON.stringify({
|
|
||||||
wine: wine
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
method: "post"
|
|
||||||
}
|
|
||||||
fetch("http://localhost:30030/api/request/new-wine", options)
|
|
||||||
.then(res => res.json())
|
|
||||||
},
|
},
|
||||||
async deleteWine(wine) {
|
async deleteWine(wine) {
|
||||||
if (window.confirm("Er du sikker på at du vil slette vinen?")) {
|
if (window.confirm("Er du sikker på at du vil slette vinen?")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user