Skip to content
Snippets Groups Projects
Commit 3b1f9f80 authored by Ingrid Martinsheimen Egge's avatar Ingrid Martinsheimen Egge :cow2:
Browse files

gjemmer matpreferanseinnstillinger

parent 21bbe407
No related branches found
No related tags found
1 merge request!21Merge profilinnstillinger into main
......@@ -3,14 +3,14 @@
<h1><br><br>Profilinnstillinger <br></h1>
<div v-if="hasProfileImage" id = "profilepicture-container">
<img width="100" src="../components/images/w66XcIlw.jpeg" alt="profile picture">
<img width="100" :src="this.currentProfile.image" alt="profile picture">
</div>
<div v-else id = "profilepicture-container">
<Icon icon="material-symbols:person" :color=iconColor :style="{ fontSize: '500px'}" />
</div>
<h2>{{this.currentProfile.name}}</h2>
<button id="changeUserBtn" >Bytt bruker</button>
<h2>{{profile.name}}</h2>
<button @click="changeProfile" id="changeUserBtn" >Bytt bruker</button>
<form @submit.prevent="submit">
<label for="brukernavn">Profilnavn</label><br>
......@@ -27,12 +27,12 @@
<h3>Profilbilde</h3>
<div id="changeUserImage">
<div v-if="hasProfileImage" id = "profilepicture-container">
<img width="50" src="../components/images/w66XcIlw.jpeg" alt="profile picture">
<img width="50" :src="this.currentProfile.image" alt="profile picture">
</div>
<div v-else id = "profilepicture-container">
<Icon icon="material-symbols:person" :color=iconColor :style="{ fontSize: '30px'}" />
</div>
<button>Endre bilde</button>
<button @click="chooseProfilePicture">Endre bilde</button>
</div>
<div id = "submitbuttonBox">
......@@ -75,12 +75,12 @@
<p class="infoText">OBS: Kontakt admin dersom du ønsker å oppdatere epost</p><br>
<p>Epost:</p>
<p>Epost: {{user.email}}</p><br>
<label for="password">Endre passord</label><br>
<input type="password" id="password" >
<input type="password" id="password" v-model="this.currentUser.newPassword">
<button class="saveBtn" @click="saveAccountSettings">Lagre kontoinnstillinger</button>
<button class="saveBtn" @click="saveAccountSettings">Lagre nytt passord</button>
</form>
<br>
......@@ -110,8 +110,8 @@
import {mapStores} from "pinia";
import {Icon} from "@iconify/vue";
import {API} from "@/util/API";
//import {useAuthStore} from "../stores/authStore";
import { useAuthStore } from "@/stores/authStore";
import router from "../router";
export default {
name: "ProfileSettings",
components: {Icon},
......@@ -121,6 +121,7 @@ export default {
const store = useAuthStore();
this.currentProfile.name = store.profile.name;
this.currentProfile.isRestricted = store.profile.restricted;
this.currentProfile.image = store.profile.profileImageUrl;
return store.profile
},
user() {
......@@ -131,36 +132,27 @@ export default {
return "#000000"
},
hasProfileImage() {
return false;
//return this.profile.image.length > 0;
return this.currentProfile.image.length > 0;
}
},
data() {
return {
currentUser: {
username: "petter@hello.no",
password: "",
newPassword: "",
},
currentProfile: {
name: "",
isRestricted: true,
image: "../components/images/w66XcIlw.jpeg",
image: "",
},
foodPreferences: [],
allergens: [],
deletionConfirmation: false,
}
},
beforeMount(){
//...mapStores(useAuthStore),
//TODO: Hent bruker
//todo hent profil
},
methods: {
saveUserSettings(){
console.log(this.currentProfile.isRestricted)
saveUserSettings(){ //profilnavn, profilbilde, profilrestriksjoner
console.log(this.currentProfile.image)
alert("(Denne knappen gjør ingen ting) brukerinnstillinger lagret!")
API.updateProfile(
this.user.id,
......@@ -169,8 +161,17 @@ export default {
this.profile.image,
);
},
saveAccountSettings(){
alert("(Denne knappen gjør ingen ting) konto oppdatert")
chooseProfilePicture(){
alert("velgBilde")
},
saveAccountSettings(){ //passord
if(this.currentUser.newPassword.length===0){
alert("Det er ikke gjort endringer, og passordet vil ikke bli oppdatert")
} else {
alert("(Denne knappen gjør ingen ting) konto oppdatert")
}
/*API.updateAccount(
this.user.id,
this.user.password,
......@@ -188,10 +189,11 @@ export default {
},
deleteUser(){
alert("(Denne knappen gjør ingen ting) bruker slettet")
//API.deleteAccount(this.user.id, token).then
},
saveFoodPreference() {
alert("(Denne knappen gjør ingen ting) matpreferanser lagret")
}
changeProfile(){
router.push("/selectProfile");
}
}
}
</script>
......
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