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

rettet opp feilmeldinger

parent 0b1018f0
No related branches found
No related tags found
1 merge request!21Merge profilinnstillinger into main
Pipeline #224733 failed
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<h2>Profilinnstillinger</h2> <h2>Profilinnstillinger</h2>
<div v-if="hasProfileImage" id = "profilepicture-container"> <div v-if="hasProfileImage" id = "profilepicture-container">
<img width="100" :src="this.updatedProfile.upImage" alt="profile picture"> <img width="100" :src="this.updatedProfile.upImage" alt="profile picture">
</div> </div>
<div v-else id = "profilepicture-container"> <div v-else id="#placeholder">
<Icon icon="material-symbols:person" :color=iconColor :style="{ fontSize: '500px'}" /> <Icon icon="material-symbols:person" :color=iconColor :style="{ fontSize: '500px'}" />
</div> </div>
<h3>{{this.profile.name}}</h3> <h3>{{this.profile.name}}</h3>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<form @submit.prevent="submit"> <form @submit.prevent="submit">
<label for="brukernavn">Profilnavn</label><br> <label for="brukernavn">Profilnavn</label><br>
<input type="text" required v-model="this.updatedProfile.upName"><br> <input type="text" required id="brukernavn" v-model="this.updatedProfile.upName"><br>
<br> <br>
<h3>Brukertype</h3> <h3>Brukertype</h3>
<input type="radio" id="normal" value="false" name="restrict" v-model="this.updatedProfile.upRestricted"> <input type="radio" id="normal" value="false" name="restrict" v-model="this.updatedProfile.upRestricted">
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
</div> </div>
<label for="chooseImageUrl">Bilde-URL:</label><br> <label for="chooseImageUrl">Bilde-URL:</label><br>
<input type="file" id="chooseImage" v-on:change="updateImage"> <!--<input type="file" id="chooseImage" v-on:change="updateImage">-->
<!--<input type="text" id="chooseImageUrl" v-model="this.updatedProfile.upImage">--> <input type="text" id="chooseImageUrl" v-model="this.updatedProfile.upImage">
</div> </div>
<br><br> <br><br>
...@@ -115,17 +115,21 @@ export default { ...@@ -115,17 +115,21 @@ export default {
id,{ id,{
name:newName, name:newName,
profileImageUrl:this.updatedProfile.upImage, profileImageUrl:this.updatedProfile.upImage,
restricted: newRestricted, isRestricted: newRestricted,
} }
).then((savedProfile)=>{ ).then((savedProfile)=>{
useAuthStore().setProfile(savedProfile); useAuthStore().setProfile(savedProfile);
this.alertMsg = "Profil oppdatert." this.alertMsg = "Profil oppdatert."
}).catch(error=> { }).catch(error=> {
console.log(error)
if (error.message === '400') { if (error.message === '400') {
if(this.updatedProfile.name !== this.initialName){
this.alertMsg = '‼️Det oppsto en feil: Det finnes allerede en bruker med samme navn‼️' if(newRestricted){
} else {
this.alertMsg = '‼️Det oppsto en feil: Sørg for at det finnes mist en standard profil på kontoen‼️ ' this.alertMsg = '‼️Det oppsto en feil: Sørg for at det finnes mist en standard profil på kontoen‼️ '
} else if(this.updatedProfile.name !== this.initialName || this.updatedProfile.name) {
this.alertMsg = '‼️Det oppsto en feil: Det finnes allerede en bruker med samme navn‼️'
} }
}else{ }else{
this.alertMsg = "‼️Det oppsto en feil.‼️" this.alertMsg = "‼️Det oppsto en feil.‼️"
......
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