Skip to content
Snippets Groups Projects
Commit e93da3db authored by Victor Ekholt Gunrell Kaste's avatar Victor Ekholt Gunrell Kaste
Browse files

feat: integrating api call for getting all challenges

parent 59b22383
No related branches found
No related tags found
1 merge request!69Feat/redesign roadmap
<script setup lang="ts"> <script setup lang="ts">
import {ref} from "vue"; import {ref, onMounted} from "vue";
import {GoalService, type GoalDTO, type CreateGoalDTO} from "@/api"
const savingGoalList = ref([
{ title: 'Spain trip', MoneyTarget: '200kr', description: 'You wanted to save 200kr for a spain trip' }, const savingGoalList = ref([] as any)
{ title: 'Italy Escapade', MoneyTarget: '200kr', description: 'Experience the magic of Italy with us! Our goal is to save 200kr for an amazing trip to Italy.' },
{ title: 'French Getaway', MoneyTarget: '200kr', description: 'Join us as we plan to save 200kr for a delightful trip to France!' }, defineProps()
{ title: 'Exploring Greece', MoneyTarget: '200kr', description: 'Dreaming of Greece? Lets work together to save 200kr for that unforgettable trip!' },
{ title: 'German Adventure', MoneyTarget: '200kr', description: 'Discover the charm of Germany with us! We are aiming to save 200kr for this exciting adventure.' }, const getGoals = async () => {
{ title: 'German Adventure', MoneyTarget: '200kr', description: 'Discover the charm of Germany with us! We are aiming to save 200kr for this exciting adventure.' }, try {
{ title: 'German Adventure', MoneyTarget: '200kr', description: 'Discover the charm of Germany with us! We are aiming to save 200kr for this exciting adventure.' }, let response = await GoalService.getGoals();
{ title: 'German Adventure', MoneyTarget: '200kr', description: 'Discover the charm of Germany with us! We are aiming to save 200kr for this exciting adventure.' } savingGoalList.value = response
]) } catch (error: any) {
console.log(error.message);
}
}
onMounted(getGoals)
const emits = defineEmits(['goToSavingGoal']); const emits = defineEmits(['goToSavingGoal']);
const goToSavingGoal = () => { const goToSavingGoal = (savingGoal: GoalDTO) => {
emits('goToSavingGoal'); emits('goToSavingGoal', savingGoal);
}; };
const deleteSavingGoal = () => { const deleteSavingGoal = () => {
...@@ -24,14 +29,14 @@ const deleteSavingGoal = () => { ...@@ -24,14 +29,14 @@ const deleteSavingGoal = () => {
</script> </script>
<template> <template>
<div v-for="(savingGoal, index) in savingGoalList" :key="index" class="card bg-primary"> <div v-for="(savingGoal, index) in savingGoalList" :key="index" class="card bg-body">
<div class="card-header"> <div class="card-header">
Saving goal {{ index + 1 }} Saving goal {{ index + 1 }}
</div> </div>
<div class="card-body"> <div class="card-body">
<h5 class="card-title">{{ savingGoal.title }}</h5> <h5 class="card-title">{{ savingGoal.goalName }}</h5>
<p class="card-text">{{ savingGoal.description }}</p> <p class="card-text">{{ savingGoal.description }}</p>
<a href="#" class="btn btn-light" @click="goToSavingGoal">Go to saving goal</a> <a href="#" class="btn btn-primary" @click="goToSavingGoal(savingGoal)">Go to saving goal</a>
<a href="#" class="btn btn-danger" @click="deleteSavingGoal" style="margin-left: 8px">Delete</a> <a href="#" class="btn btn-danger" @click="deleteSavingGoal" style="margin-left: 8px">Delete</a>
</div> </div>
</div> </div>
...@@ -42,11 +47,20 @@ const deleteSavingGoal = () => { ...@@ -42,11 +47,20 @@ const deleteSavingGoal = () => {
color: white; color: white;
} }
.card-header {
background-color: #40698A;
}
.card-body {
background-color: #447093;
}
* { * {
font-weight: 600; font-weight: 600;
} }
.card { .card {
margin-bottom: 20px; margin-bottom: 20px;
border: none;
} }
</style> </style>
\ No newline at end of file
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