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