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>
|
<template>
|
||||||
<toolbar-component pageTitle="Member Profile" />
|
<toolbar-component pageTitle="Member Profile" />
|
||||||
<q-page padding>
|
<q-page
|
||||||
<q-list bordered>
|
padding
|
||||||
|
class="row">
|
||||||
|
<q-list class="col-sm-4 col-12">
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-item>
|
<q-item>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-avatar icon="person" />
|
<q-avatar icon="person" />
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
{{ authStore.currentUser?.name }}
|
|
||||||
<q-item-label caption>Name</q-item-label>
|
<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-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
@@ -17,15 +47,27 @@
|
|||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label overline>Certifications</q-item-label>
|
<q-item-label overline>Certifications</q-item-label>
|
||||||
<div>
|
<div>
|
||||||
<q-chip square icon="verified" color="green" text-color="white"
|
<q-chip
|
||||||
>J/27</q-chip
|
square
|
||||||
>
|
icon="verified"
|
||||||
<q-chip square icon="verified" color="blue" text-color="white"
|
color="green"
|
||||||
>Capri25</q-chip
|
text-color="white">
|
||||||
>
|
J/27
|
||||||
<q-chip square icon="verified" color="grey-9" text-color="white"
|
</q-chip>
|
||||||
>Night</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>
|
</div>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
@@ -36,6 +78,21 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ToolbarComponent from 'src/components/ToolbarComponent.vue';
|
import ToolbarComponent from 'src/components/ToolbarComponent.vue';
|
||||||
import { useAuthStore } from 'src/stores/auth';
|
import { useAuthStore } from 'src/stores/auth';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const authStore = useAuthStore();
|
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>
|
</script>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const links = <Link[]>[
|
|||||||
to: '/profile',
|
to: '/profile',
|
||||||
icon: 'account_circle',
|
icon: 'account_circle',
|
||||||
front_links: false,
|
front_links: false,
|
||||||
enabled: false,
|
enabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Boats',
|
name: 'Boats',
|
||||||
|
|||||||
@@ -103,11 +103,17 @@ export const useAuthStore = defineStore('auth', () => {
|
|||||||
return account.deleteSession('current').then((currentUser.value = null));
|
return account.deleteSession('current').then((currentUser.value = null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function updateName(name: string) {
|
||||||
|
await account.updateName(name);
|
||||||
|
currentUser.value = await account.get();
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentUser,
|
currentUser,
|
||||||
getUserNameById,
|
getUserNameById,
|
||||||
hasRequiredRole,
|
hasRequiredRole,
|
||||||
register,
|
register,
|
||||||
|
updateName,
|
||||||
login,
|
login,
|
||||||
googleLogin,
|
googleLogin,
|
||||||
discordLogin,
|
discordLogin,
|
||||||
|
|||||||
Reference in New Issue
Block a user