Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
idatt2106_2024_03_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
Scrum_Team_3
idatt2106_2024_03_frontend
Commits
a24eba09
Commit
a24eba09
authored
11 months ago
by
vildemv
Browse files
Options
Downloads
Patches
Plain Diff
Added method to formatte date to the inactive challenge display.
parent
66bddcd0
No related branches found
No related tags found
1 merge request
!53
Frontend improvements
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/challenge/InactiveChallengeDisplay.vue
+14
-6
14 additions, 6 deletions
src/components/challenge/InactiveChallengeDisplay.vue
with
14 additions
and
6 deletions
src/components/challenge/
Potential
ChallengeDisplay.vue
→
src/components/challenge/
Inactive
ChallengeDisplay.vue
+
14
−
6
View file @
a24eba09
...
...
@@ -2,9 +2,7 @@
import
{
activateChallenge
,
deleteChallenge
}
from
'
@/utils/challengeutils
'
import
{
useTokenStore
}
from
'
@/stores/token
'
const
token
:
string
=
useTokenStore
().
jwtToken
;
const
emits
=
defineEmits
([
'
challengeAccepted
'
,
'
challengeDeclined
'
]);
import
eventBus
from
'
@/components/service/eventBus.js
'
interface
Challenge
{
'
challengeId
'
:
number
,
...
...
@@ -21,12 +19,21 @@ const props = defineProps({
}
});
const
token
:
string
=
useTokenStore
().
jwtToken
;
const
emit
=
defineEmits
([
'
challengeAccepted
'
,
'
challengeDeclined
'
]);
const
expirationDate
=
()
=>
{
return
new
Date
(
props
.
challenge
?.
expirationDate
).
toLocaleDateString
(
'
en-GB
'
,
{
day
:
'
2-digit
'
,
month
:
'
2-digit
'
,
year
:
'
numeric
'
});
}
const
declineChallenge
=
async
()
=>
{
console
.
log
(
'
decline-button clicked
'
)
if
(
props
.
challenge
.
challengeId
){
try
{
await
deleteChallenge
(
token
,
props
.
challenge
.
challengeId
);
emit
s
(
'
challengeDeclined
'
,
props
.
challenge
.
challengeId
);
emit
(
'
challengeDeclined
'
,
props
.
challenge
.
challengeId
);
}
catch
(
error
){
alert
(
'
Noe gikk galt! Venligst prøv på nytt.
'
)
}
...
...
@@ -39,7 +46,8 @@ const acceptChallenge = async () => {
if
(
props
.
challenge
.
challengeId
){
try
{
await
activateChallenge
(
token
,
props
.
challenge
.
challengeId
);
emits
(
'
challengeAccepted
'
,
props
.
challenge
.
challengeId
);
emit
(
'
challengeAccepted
'
,
props
.
challenge
.
challengeId
);
eventBus
.
emit
(
'
updateChallenges
'
);
}
catch
(
error
){
alert
(
'
Noe gikk galt! Venligst prøv på nytt.
'
)
}
...
...
@@ -52,7 +60,7 @@ const acceptChallenge = async () => {
<h2
class=
"title"
>
{{
props
.
challenge
.
challengeTitle
}}
</h2>
<h4
class=
"description"
>
{{
props
.
challenge
.
challengeDescription
}}
</h4>
<div
class=
"info"
>
<h4>
Utløpsdato:
{{
props
.
challenge
.
expirationDate
}}
|
</h4>
<h4>
Utløpsdato:
{{
expirationDate
()
}}
|
</h4>
<h4
class=
"sum"
>
Sparesum:
{{
props
.
challenge
.
goalSum
}}
kr,-
</h4>
</div>
<div
class=
"options"
>
...
...
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