From 78ffa651ea0f20d8701b7afe1da6ea09b212b455 Mon Sep 17 00:00:00 2001 From: ingrid <ingrimeg@stud.ntnu.no> Date: Tue, 25 Apr 2023 09:27:09 +0200 Subject: [PATCH] store --- src/views/ProfileSettings.vue | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/views/ProfileSettings.vue b/src/views/ProfileSettings.vue index 181ff31..1060cc9 100644 --- a/src/views/ProfileSettings.vue +++ b/src/views/ProfileSettings.vue @@ -9,12 +9,12 @@ <Icon icon="material-symbols:person" :color=iconColor :style="{ fontSize: '500px'}" /> </div> - <h2>{{currentProfile.name}}</h2> + <h2>{{profile.name}}</h2> <button id="changeUserBtn" >Bytt bruker</button> <form @submit.prevent="submit"> <label for="brukernavn">Profilnavn</label><br> - <input type="text" required v-model="currentProfile.name"><br> + <input type="text" required><br> <br> <h4>Brukertype</h4> <input type="radio" id="normal" value="false"> @@ -76,7 +76,6 @@ <p class="infoText">OBS: Kontakt admin dersom du ønsker å oppdatere epost</p><br> <p>Epost:</p> - <p>{{userStore.user.email}}</p><br> <label for="password">Endre passord</label><br> <input type="password" id="password" > @@ -99,29 +98,38 @@ <br><br><br> </main> </template> +<script setup> -<script> + + +</script> + + +<script> +import {mapStores} from "pinia"; import {Icon} from "@iconify/vue"; import {API} from "@/util/API"; -import {mapState, mapStores} from "pinia"; +//import {useAuthStore} from "../stores/authStore"; import { useAuthStore } from "@/stores/authStore"; - export default { name: "ProfileSettings", components: {Icon}, setup() { - const userStore = useAuthStore() - return {...mapStores(userStore)} + //const store = useAuthStore(); + //this.curruser= store.user; }, computed: { + ...mapStores(useAuthStore), + profile() { + const store = useAuthStore(); + return store.profile + }, currentUser() { - const store = useAuthStore() - return store.user; + //return store.user; }, currentProfile() { - const store = useAuthStore() - return store.profile; + //return store.profile; }, iconColor() { return "#000000" @@ -133,6 +141,7 @@ export default { }, data() { return { + curruser : "", /*user: { id: "", username: "petter@hello.no", -- GitLab