Skip to content
Snippets Groups Projects
Commit a39b33cb authored by Jakob Karevold Grønhaug's avatar Jakob Karevold Grønhaug
Browse files

Merge branch 'profile-creation-touchups' into 'main'

småfikser i brukerflyt ved å opprette profil

See merge request !29
parents 7fdc2962 55c5a856
No related branches found
No related tags found
1 merge request!29småfikser i brukerflyt ved å opprette profil
Pipeline #226499 failed
...@@ -12,7 +12,9 @@ export default { ...@@ -12,7 +12,9 @@ export default {
profileImageUrl: "", profileImageUrl: "",
name: "", name: "",
isRestricted: false isRestricted: false
} },
pin: "",
errorMsg: ""
}; };
}, },
methods: { methods: {
...@@ -25,15 +27,21 @@ export default { ...@@ -25,15 +27,21 @@ export default {
if (typeof image === 'undefined') { if (typeof image === 'undefined') {
this.authStore.profile = profile; this.authStore.profile = profile;
this.authStore.profiles.push(profile);
router.push("/"); router.push("/");
} else {
API.uploadProfileImage(image, id)
.then((updatedProfile) => {
this.authStore.profile = updatedProfile;
this.authStore.profiles.push(profile);
router.push("/");
});
} }
API.uploadProfileImage(image, id)
.then((updatedProfile) => {
this.authStore.profile = updatedProfile;
router.push("/");
});
}) })
.catch(() => {
this.errorMsg = "Oops! Dette navnet er allerede i bruk på en annen profil, bruk et annet navn"
})
}, },
updateImg() { updateImg() {
let file = document.getElementById("profile_img").files[0]; let file = document.getElementById("profile_img").files[0];
...@@ -68,9 +76,14 @@ export default { ...@@ -68,9 +76,14 @@ export default {
<input name="name" type="text" v-model="profile.name"> <input name="name" type="text" v-model="profile.name">
<div class="check_container"> <div class="check_container">
<label for="limited">Begrenset:</label> <label for="limited">Begrenset:</label>
<input type="checkbox" name="limited" id="limited"> <input type="checkbox" v-model="this.profile.isRestricted" name="limited" id="limited">
</div>
<div v-if="!this.profile.isRestricted" class="pincode-container">
<label for="pincode-field">PIN:</label>
<input id="pincode-field" type="tel" v-model="pin" maxlength="4" placeholder="0000" />
</div> </div>
</form> </form>
<p>{{ this.errorMsg }}</p>
<button @click="submit">Opprett</button> <button @click="submit">Opprett</button>
</main> </main>
</template> </template>
...@@ -101,6 +114,10 @@ main { ...@@ -101,6 +114,10 @@ main {
form { form {
gap: $gap; gap: $gap;
} }
p {
max-width: 20em;
}
} }
#profile_img_label { #profile_img_label {
...@@ -153,6 +170,21 @@ main { ...@@ -153,6 +170,21 @@ main {
transition: all 350ms eases; transition: all 350ms eases;
} }
.pincode-container {
width: 100%;
display: flex;
input {
border-radius: .2em;
border: 1px solid black;
height: 50px;
width: 105px;
margin: 0 5px;
font-size: 38px;
padding: 5px;
}
}
form { form {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -166,7 +198,6 @@ button { ...@@ -166,7 +198,6 @@ button {
border-radius: .5rem; border-radius: .5rem;
background-color: $light-green; background-color: $light-green;
color: white;
font-weight: bold; font-weight: bold;
} }
</style> </style>
\ No newline at end of file
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