diff --git a/software/src/components/navigation/footerItems.vue b/software/src/components/navigation/footerItems.vue
index 471a038..63f2183 100644
--- a/software/src/components/navigation/footerItems.vue
+++ b/software/src/components/navigation/footerItems.vue
@@ -1,14 +1,11 @@
-
+
-
+
({
@@ -97,6 +97,7 @@ export const useBasketStore = defineStore('basketStore', {
async takeOrder() {
const accountStore = useAccountStore()
const feedbackStore = useFeedbackStore()
+ const exerciseStore = useExerciseStore()
await createOrder(
accountStore.userAccount.id,
@@ -110,6 +111,9 @@ export const useBasketStore = defineStore('basketStore', {
this.itemsInBasket = []
feedbackStore.changeBanner(BannerStateEnum.ORDERPLACESUCCESSFUL)
+
+ // Exercise 0.2 is solved
+ exerciseStore.solveExercise(0, 2)
} else {
feedbackStore.changeBanner(BannerStateEnum.ERROR)
}
diff --git a/software/src/stores/exercise.store.ts b/software/src/stores/exercise.store.ts
new file mode 100644
index 0000000..66b0221
--- /dev/null
+++ b/software/src/stores/exercise.store.ts
@@ -0,0 +1,34 @@
+import { fetchAllExerciseGroups, updateExercise } from "@/data/api/exerciseApi";
+import { ExerciseGroupApiModel } from "@/data/models/exercises/exerciseGroupApiModel";
+import { defineStore } from "pinia";
+import { ref } from "vue";
+
+export const useExerciseStore = defineStore("exerciseStore", {
+ state: () => ({
+ exerciseGroups: ref>([]),
+
+ /** Request to server sent, waiting for data response */
+ fetchInProgress: ref(false)
+ }),
+
+ actions: {
+ getAllExercises() {
+ this.fetchInProgress = true
+
+ fetchAllExerciseGroups()
+ .then(result => {
+ this.exerciseGroups = result.data
+ this.fetchInProgress = false
+ })
+ },
+
+ solveExercise(exerciseGroupNr: number, exerciseNr: number) {
+ this.fetchInProgress = true
+
+ updateExercise(exerciseGroupNr, exerciseNr, true)
+ .then(result => {
+ this.getAllExercises()
+ })
+ }
+ }
+})
\ No newline at end of file