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-2024-07
frontend
Commits
7d756eb0
Commit
7d756eb0
authored
10 months ago
by
Anders Høvik
Browse files
Options
Downloads
Patches
Plain Diff
Change array-type of goals
parent
1721d77c
No related branches found
No related tags found
1 merge request
!86
Feature/history endpoint
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/UserProfile/ExternalProfile.vue
+15
-11
15 additions, 11 deletions
src/components/UserProfile/ExternalProfile.vue
with
15 additions
and
11 deletions
src/components/UserProfile/ExternalProfile.vue
+
15
−
11
View file @
7d756eb0
<
script
setup
lang=
"ts"
>
import
{
useRoute
,
useRouter
}
from
"
vue-router
"
;
import
{
onMounted
,
r
ef
}
from
"
vue
"
;
import
{
UserService
,
type
ProfileDTO
,
GoalService
}
from
"
@/api
"
;
import
{
onMounted
,
type
Ref
,
ref
,
type
UnwrapR
ef
}
from
"
vue
"
;
import
{
UserService
,
type
ProfileDTO
,
GoalService
,
type
GoalDTO
}
from
"
@/api
"
;
let
numberOfHistory
=
6
;
...
...
@@ -12,7 +12,7 @@ let cardTitles = ["Spain tour", "Food waste", "Coffee", "Concert", "New book", "
let
hasHistory
=
ref
(
true
)
let
firstname
=
ref
();
let
lastname
=
ref
();
let
goals
=
ref
([]);
let
goals
:
Ref
<
UnwrapRef
<
GoalDTO
[]
>>
=
ref
([]);
let
username
=
ref
()
...
...
@@ -41,7 +41,7 @@ function toRoadmap(){
//todo Make a store of a friend-instance
onMounted
(
async
()
=>
{
try
{
goals
=
await
UserService
.
getProfile
({
let
response
=
await
UserService
.
getProfile
({
userId
:
id
.
value
.
id
})
profile
=
response
;
...
...
@@ -62,13 +62,17 @@ function addFriend() {
}
async
function
getGoals
()
{
let
response
=
await
GoalService
.
getGoals
();
console
.
log
(
"
number of goals:
"
,
response
.
length
)
if
(
response
.
length
>
0
)
{
hasHistory
.
value
=
true
}
else
{
hasHistory
.
value
=
false
console
.
log
(
'
No history
'
)
try
{
goals
.
value
=
await
GoalService
.
getGoals
();
console
.
log
(
"
number of goals:
"
,
goals
.
value
.
length
)
if
(
goals
.
value
.
length
>
0
)
{
hasHistory
.
value
=
true
}
else
{
hasHistory
.
value
=
false
console
.
log
(
'
No history
'
)
}
}
catch
(
error
){
console
.
error
(
"
Something went wrong getting the goals:
"
,
error
)
}
}
...
...
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