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 @@
<h2>Profilinnstillinger</h2>
<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 v-else id = "profilepicture-container">
<Icon icon="material-symbols:person" :color=iconColor :style="{ fontSize: '500px'}" />
<div v-else id="#placeholder">
<Icon icon="material-symbols:person" :color=iconColor :style="{ fontSize: '500px'}" />
</div>
<h3>{{this.profile.name}}</h3>
......@@ -13,7 +13,7 @@
<form @submit.prevent="submit">
<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>
<h3>Brukertype</h3>
<input type="radio" id="normal" value="false" name="restrict" v-model="this.updatedProfile.upRestricted">
......@@ -33,8 +33,8 @@
</div>
<label for="chooseImageUrl">Bilde-URL:</label><br>
<input type="file" id="chooseImage" v-on:change="updateImage">
<!--<input type="text" id="chooseImageUrl" v-model="this.updatedProfile.upImage">-->
<!--<input type="file" id="chooseImage" v-on:change="updateImage">-->
<input type="text" id="chooseImageUrl" v-model="this.updatedProfile.upImage">
</div>
<br><br>
......@@ -115,17 +115,21 @@ export default {
id,{
name:newName,
profileImageUrl:this.updatedProfile.upImage,
restricted: newRestricted,
isRestricted: newRestricted,
}
).then((savedProfile)=>{
useAuthStore().setProfile(savedProfile);
this.alertMsg = "Profil oppdatert."
}).catch(error=> {
console.log(error)
if (error.message === '400') {
if(this.updatedProfile.name !== this.initialName){
this.alertMsg = '‼️Det oppsto en feil: Det finnes allerede en bruker med samme navn‼️'
} else {
if(newRestricted){
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{
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