feat: Re-enable profile page and allow editing name
Some checks failed
Build BAB Application Deployment Artifact / build (push) Failing after 4m48s
Some checks failed
Build BAB Application Deployment Artifact / build (push) Failing after 4m48s
This commit is contained in:
@@ -1,15 +1,45 @@
|
||||
<template>
|
||||
<toolbar-component pageTitle="Member Profile" />
|
||||
<q-page padding>
|
||||
<q-list bordered>
|
||||
<q-page
|
||||
padding
|
||||
class="row">
|
||||
<q-list class="col-sm-4 col-12">
|
||||
<q-separator />
|
||||
<q-item>
|
||||
<q-item-section avatar>
|
||||
<q-avatar icon="person" />
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
{{ authStore.currentUser?.name }}
|
||||
<q-item-label caption>Name</q-item-label>
|
||||
<q-input
|
||||
filled
|
||||
v-model="newName"
|
||||
@keydown.enter.prevent="editName"
|
||||
v-if="newName !== undefined" />
|
||||
<div v-else>
|
||||
{{ authStore.currentUser?.name }}
|
||||
</div>
|
||||
</q-item-section>
|
||||
<q-item-section avatar>
|
||||
<q-btn
|
||||
square
|
||||
@click="editName"
|
||||
:icon="newName !== undefined ? 'check' : 'edit'" />
|
||||
<q-btn
|
||||
v-if="newName !== undefined"
|
||||
square
|
||||
color="negative"
|
||||
@click="newName = undefined"
|
||||
icon="cancel" />
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item>
|
||||
<q-item-section avatar>
|
||||
<q-avatar icon="email" />
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label caption>E-mail</q-item-label>
|
||||
{{ authStore.currentUser?.email }}
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-separator />
|
||||
@@ -17,15 +47,27 @@
|
||||
<q-item-section>
|
||||
<q-item-label overline>Certifications</q-item-label>
|
||||
<div>
|
||||
<q-chip square icon="verified" color="green" text-color="white"
|
||||
>J/27</q-chip
|
||||
>
|
||||
<q-chip square icon="verified" color="blue" text-color="white"
|
||||
>Capri25</q-chip
|
||||
>
|
||||
<q-chip square icon="verified" color="grey-9" text-color="white"
|
||||
>Night</q-chip
|
||||
>
|
||||
<q-chip
|
||||
square
|
||||
icon="verified"
|
||||
color="green"
|
||||
text-color="white">
|
||||
J/27
|
||||
</q-chip>
|
||||
<q-chip
|
||||
square
|
||||
icon="verified"
|
||||
color="blue"
|
||||
text-color="white">
|
||||
Capri25
|
||||
</q-chip>
|
||||
<q-chip
|
||||
square
|
||||
icon="verified"
|
||||
color="grey-9"
|
||||
text-color="white">
|
||||
Night
|
||||
</q-chip>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
@@ -36,6 +78,21 @@
|
||||
<script setup lang="ts">
|
||||
import ToolbarComponent from 'src/components/ToolbarComponent.vue';
|
||||
import { useAuthStore } from 'src/stores/auth';
|
||||
import { ref } from 'vue';
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const newName = ref();
|
||||
|
||||
const editName = async () => {
|
||||
if (newName.value) {
|
||||
try {
|
||||
await authStore.updateName(newName.value);
|
||||
newName.value = undefined;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
} else {
|
||||
newName.value = authStore.currentUser?.name || '';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -24,7 +24,7 @@ export const links = <Link[]>[
|
||||
to: '/profile',
|
||||
icon: 'account_circle',
|
||||
front_links: false,
|
||||
enabled: false,
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
name: 'Boats',
|
||||
|
||||
@@ -103,11 +103,17 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
return account.deleteSession('current').then((currentUser.value = null));
|
||||
}
|
||||
|
||||
async function updateName(name: string) {
|
||||
await account.updateName(name);
|
||||
currentUser.value = await account.get();
|
||||
}
|
||||
|
||||
return {
|
||||
currentUser,
|
||||
getUserNameById,
|
||||
hasRequiredRole,
|
||||
register,
|
||||
updateName,
|
||||
login,
|
||||
googleLogin,
|
||||
discordLogin,
|
||||
|
||||
Reference in New Issue
Block a user