Compare commits
2 Commits
643d74e29d
...
6ec4a1e025
| Author | SHA1 | Date | |
|---|---|---|---|
|
6ec4a1e025
|
|||
|
d063b0cf0d
|
@@ -118,6 +118,7 @@ async function login(email: string, password: string) {
|
|||||||
});
|
});
|
||||||
appRouter.replace({ name: 'index' });
|
appRouter.replace({ name: 'index' });
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
|
console.log(error);
|
||||||
if (error instanceof AppwriteException) {
|
if (error instanceof AppwriteException) {
|
||||||
if (error.type === 'user_session_already_exists') {
|
if (error.type === 'user_session_already_exists') {
|
||||||
appRouter.replace({ name: 'index' });
|
appRouter.replace({ name: 'index' });
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ import { AppwriteException } from 'appwrite';
|
|||||||
const email = ref('');
|
const email = ref('');
|
||||||
const token = ref('');
|
const token = ref('');
|
||||||
const userId = ref();
|
const userId = ref();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
console.log('version:' + process.env.VUE_APP_VERSION);
|
console.log('version:' + process.env.VUE_APP_VERSION);
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ const doTokenLogin = async () => {
|
|||||||
spinner: false,
|
spinner: false,
|
||||||
icon: 'check_circle',
|
icon: 'check_circle',
|
||||||
});
|
});
|
||||||
useRouter().replace({ name: 'index' });
|
router.replace({ name: 'index' });
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
if (error instanceof AppwriteException) {
|
if (error instanceof AppwriteException) {
|
||||||
if (error.type === 'user_session_already_exists') {
|
if (error.type === 'user_session_already_exists') {
|
||||||
|
|||||||
@@ -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