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

Merge branch 'feat/redesign-roadmap' into 'main'

Feat/redesign roadmap

See merge request !71
parents be179425 8af487ee
No related branches found
No related tags found
1 merge request!71Feat/redesign roadmap
Pipeline #282430 passed with warnings
...@@ -3,6 +3,7 @@ import BaseInput from '@/components/InputFields/BaseInput.vue' ...@@ -3,6 +3,7 @@ import BaseInput from '@/components/InputFields/BaseInput.vue'
import { ref } from 'vue' import { ref } from 'vue'
import Button1 from '@/components/Buttons/Button1.vue' import Button1 from '@/components/Buttons/Button1.vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import {type CreateGoalDTO, GoalService} from "@/api";
const router = useRouter(); const router = useRouter();
const emit = defineEmits(['changeRouterEvent']) const emit = defineEmits(['changeRouterEvent'])
...@@ -13,8 +14,9 @@ const titleRef = ref<string>() ...@@ -13,8 +14,9 @@ const titleRef = ref<string>()
let descriptionRef = ref<string>() let descriptionRef = ref<string>()
const sumRef = ref<number>() const sumRef = ref<number>()
const dateRef = ref<string>() const dateRef = ref<string>()
const errorMessage = ref("")
const handleSubmit = () => { const handleSubmit = async () => {
formRef.value.classList.add("was-validated") formRef.value.classList.add("was-validated")
const form = formRef.value const form = formRef.value
if (!form.checkValidity()) { if (!form.checkValidity()) {
...@@ -22,7 +24,20 @@ const handleSubmit = () => { ...@@ -22,7 +24,20 @@ const handleSubmit = () => {
} }
// TODO integrate user creation and goal creation with backend. // TODO integrate user creation and goal creation with backend.
const createGoalPayload: CreateGoalDTO = {
name: titleRef.value,
description: descriptionRef.value,
targetAmount: sumRef.value,
targetDate: dateRef.value + " 00:00:00.000000000",
};
try {
await GoalService.createGoal({ requestBody: createGoalPayload });
await router.push("/")
} catch (error: any) {
console.log(error.message);
errorMessage.value = error.message;
}
} }
const getTodayDate = () => { const getTodayDate = () => {
...@@ -98,6 +113,9 @@ const handleSumInputEvent = (newSum: number) => { ...@@ -98,6 +113,9 @@ const handleSumInputEvent = (newSum: number) => {
<div class="confirm-button-container"> <div class="confirm-button-container">
<button1 id="confirmButton" @click="handleSubmit" button-text="Continue"></button1> <button1 id="confirmButton" @click="handleSubmit" button-text="Continue"></button1>
</div> </div>
<div style="color: red">
{{ errorMessage }}
</div>
</div> </div>
</template> </template>
......
...@@ -76,7 +76,7 @@ const signUpUser = async () => { ...@@ -76,7 +76,7 @@ const signUpUser = async () => {
role: response.role, role: response.role,
}); });
useUserInfoStore().resetPassword() useUserInfoStore().resetPassword()
await router.push({ name: 'home' }); await router.push("/first-saving-goal")
} }
catch (error) { catch (error) {
errorMsg.value = handleUnknownError(error); errorMsg.value = handleUnknownError(error);
...@@ -89,7 +89,11 @@ const handleSubmit = () => { ...@@ -89,7 +89,11 @@ const handleSubmit = () => {
} }
useConfigurationStore().setChallenges(chosenChallenges.value) useConfigurationStore().setChallenges(chosenChallenges.value)
console.log(useConfigurationStore().getChallenges) console.log(useConfigurationStore().getChallenges)
router.push("/first-saving-goal") try {
signUpUser()
} catch (e) {
console.log(e)
}
} }
</script> </script>
......
...@@ -24,7 +24,6 @@ const createGoalClick = async () => { ...@@ -24,7 +24,6 @@ const createGoalClick = async () => {
targetDate: date.value + " 00:00:00.000000000", targetDate: date.value + " 00:00:00.000000000",
}; };
console.log(createGoalPayload)
try { try {
let response = await GoalService.createGoal({ requestBody: createGoalPayload }); let response = await GoalService.createGoal({ requestBody: createGoalPayload });
...@@ -85,5 +84,7 @@ const createGoalClick = async () => { ...@@ -85,5 +84,7 @@ const createGoalClick = async () => {
.col-lg-8 { .col-lg-8 {
width: 63%; width: 63%;
margin-top: 50px; margin-top: 50px;
padding-right: 56px;
padding-bottom: 28px;
} }
</style> </style>
\ No newline at end of file
...@@ -83,17 +83,19 @@ const handleSubmit = async () => { ...@@ -83,17 +83,19 @@ const handleSubmit = async () => {
id="firstNameInput" id="firstNameInput"
input-id="first-name" input-id="first-name"
type="text" type="text"
pattern="^[^\d]+$"
label="Fornavn" label="Fornavn"
placeholder="Skriv inn ditt fornavn" placeholder="Skriv inn ditt fornavn"
invalid-message="Ugyldig fornavn"/> invalid-message="Ugyldig fornavn, husk ingen tall"/>
<BaseInput :model-value="surnameRef" <BaseInput :model-value="surnameRef"
@input-change-event="handleSurnameInputEvent" @input-change-event="handleSurnameInputEvent"
id="surnameInput" id="surnameInput"
input-id="surname" input-id="surname"
type="text" type="text"
pattern="^[^\d]+$"
label="Etternavn" label="Etternavn"
placeholder="Skriv inn ditt etternavn" placeholder="Skriv inn ditt etternavn"
invalid-message="Ugyldig etternavn"/> invalid-message="Ugyldig etternavn, husk ingen tall"/>
<BaseInput :model-value="emailRef" <BaseInput :model-value="emailRef"
@input-change-event="handleEmailInputEvent" @input-change-event="handleEmailInputEvent"
id="emailInput" id="emailInput"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment