Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IDATT2106 Scrum Team 02
Frontend
Commits
986fff17
Commit
986fff17
authored
1 year ago
by
Ingrid Martinsheimen Egge
Browse files
Options
Downloads
Patches
Plain Diff
la inn tab-index
parent
41ecff43
No related branches found
Branches containing commit
No related tags found
1 merge request
!13
Fridge view
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/ItemSearch.vue
+7
-6
7 additions, 6 deletions
src/components/ItemSearch.vue
src/util/API.js
+2
-2
2 additions, 2 deletions
src/util/API.js
src/views/SelectProfileView.vue
+1
-1
1 addition, 1 deletion
src/views/SelectProfileView.vue
with
10 additions
and
9 deletions
src/components/ItemSearch.vue
+
7
−
6
View file @
986fff17
...
...
@@ -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
)
)
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/util/API.js
+
2
−
2
View file @
986fff17
...
...
@@ -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:
"
);
})
...
...
This diff is collapsed.
Click to expand it.
src/views/SelectProfileView.vue
+
1
−
1
View file @
986fff17
...
...
@@ -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"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment