Skip to content
Snippets Groups Projects
Commit 986fff17 authored by Ingrid Martinsheimen Egge's avatar Ingrid Martinsheimen Egge :cow2:
Browse files

la inn tab-index

parent 41ecff43
No related branches found
No related tags found
1 merge request!13Fridge view
......@@ -38,15 +38,16 @@ export default {
addToFridge(){
const num = this.numOfItemsToAdd;
//const request = [{ingredient: this.selectedItem}]
const ingr = {
item: this.selectedItem,
amount: this.selectedItem.amount //why?
const ingred = {
item: this.selectedItem.id,
amount: this.selectedItem.amount
}
const request = [{ingredient: JSON.stringify(ingr)}]
const request = [{itemId: this.selectedItem.id, amount: this.selectedItem.amount}]
//const request = [{ingredient_id: ingred},{ingredient: ingred}]
//const request = [{ingredient: JSON.stringify(ingred)}]
console.log(request)
API.addToFridge(request)
API.addToFridge(JSON.stringify(request))
}
}
}
......
......@@ -158,10 +158,10 @@ export const API = {
addToFridge: async(request) =>{
const authStore = useAuthStore();
axios.post(`${import.meta.env.VITE_BACKEND_URL}/fridge`, request,{
axios.post(`${import.meta.env.VITE_BACKEND_URL}/fridge/items`, request,{
headers: { Authorization: `Bearer ${authStore.token}` },
}).then((response) => {
return response.data;
return response.data.value.content;
}).catch(()=> {
throw new Error("Could not add item to fridge: ");
})
......
......@@ -45,7 +45,7 @@
<h1>Hvem bruker appen?</h1>
<div class="icons">
<div v-for="profile in this.profiles" @click=selectProfile(profile.id) class="icon">
<div v-for="profile in this.profiles" tabindex="0" @click=selectProfile(profile.id) class="icon" role="button" :aria-label="profile.name">
<img v-if="profile.profileImageUrl == ''" src="https://t4.ftcdn.net/jpg/02/15/84/43/360_F_215844325_ttX9YiIIyeaR7Ne6EaLLjMAmy4GvPC69.jpg" alt="profile image">
<img v-else :src=profile.profileImageUrl alt="profile image">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment