Skip to content
Snippets Groups Projects
Commit ce5eb780 authored by Torbjørn Antonsen's avatar Torbjørn Antonsen
Browse files

Added scripts for getting totalSavings for all users and displaying it on infoComponent

parent 77796134
No related branches found
No related tags found
1 merge request!46Resolve "Show total savings"
Pipeline #279648 failed
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { getTotalSavings } from "@/utils/userUtils"
let totalSavings = ref(0)
onMounted(async () => {
totalSavings.value = await getTotalSavings()
});
</script>
<template>
<div id = InfoComponent>
<h2 id = Quote><strong>Sparetips: </strong>Sett av et jevnt beløp hver måned på sparekonto eller lignende.</h2>
<h2 id = TotalSavings>Våre brukere har spart til sammen <strong>5000</strong> nok</h2>
<h2 id = TotalSavings>Våre brukere har spart til sammen <strong>{{ totalSavings }}</strong> nok</h2>
</div>
</template>
......
import axios from "axios";
export const getTotalSavings = async():Promise<any> => {
const config = {
headers: {
"Content-Type": "application/json"
}
};
try {
const response = await axios.get("http://localhost:8080/users/get/totalSavings", config)
return response.data
} catch (error) {
console.log(error)
}
}
\ 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