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'
import { ref } from 'vue'
import Button1 from '@/components/Buttons/Button1.vue'
import { useRouter } from 'vue-router'
import {type CreateGoalDTO, GoalService} from "@/api";
const router = useRouter();
const emit = defineEmits(['changeRouterEvent'])
......@@ -13,8 +14,9 @@ const titleRef = ref<string>()
let descriptionRef = ref<string>()
const sumRef = ref<number>()
const dateRef = ref<string>()
const errorMessage = ref("")
const handleSubmit = () => {
const handleSubmit = async () => {
formRef.value.classList.add("was-validated")
const form = formRef.value
if (!form.checkValidity()) {
......@@ -22,7 +24,20 @@ const handleSubmit = () => {
}
// 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 = () => {
......@@ -98,6 +113,9 @@ const handleSumInputEvent = (newSum: number) => {
<div class="confirm-button-container">
<button1 id="confirmButton" @click="handleSubmit" button-text="Continue"></button1>
</div>
<div style="color: red">
{{ errorMessage }}
</div>
</div>
</template>
......
......@@ -76,7 +76,7 @@ const signUpUser = async () => {
role: response.role,
});
useUserInfoStore().resetPassword()
await router.push({ name: 'home' });
await router.push("/first-saving-goal")
}
catch (error) {
errorMsg.value = handleUnknownError(error);
......@@ -89,7 +89,11 @@ const handleSubmit = () => {
}
useConfigurationStore().setChallenges(chosenChallenges.value)
console.log(useConfigurationStore().getChallenges)
router.push("/first-saving-goal")
try {
signUpUser()
} catch (e) {
console.log(e)
}
}
</script>
......
......@@ -24,7 +24,6 @@ const createGoalClick = async () => {
targetDate: date.value + " 00:00:00.000000000",
};
console.log(createGoalPayload)
try {
let response = await GoalService.createGoal({ requestBody: createGoalPayload });
......@@ -85,5 +84,7 @@ const createGoalClick = async () => {
.col-lg-8 {
width: 63%;
margin-top: 50px;
padding-right: 56px;
padding-bottom: 28px;
}
</style>
\ No newline at end of file
......@@ -83,17 +83,19 @@ const handleSubmit = async () => {
id="firstNameInput"
input-id="first-name"
type="text"
pattern="^[^\d]+$"
label="Fornavn"
placeholder="Skriv inn ditt fornavn"
invalid-message="Ugyldig fornavn"/>
invalid-message="Ugyldig fornavn, husk ingen tall"/>
<BaseInput :model-value="surnameRef"
@input-change-event="handleSurnameInputEvent"
id="surnameInput"
input-id="surname"
type="text"
pattern="^[^\d]+$"
label="Etternavn"
placeholder="Skriv inn ditt etternavn"
invalid-message="Ugyldig etternavn"/>
invalid-message="Ugyldig etternavn, husk ingen tall"/>
<BaseInput :model-value="emailRef"
@input-change-event="handleEmailInputEvent"
id="emailInput"
......
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