feat: profile image for non system admin user
This commit is contained in:
parent
ae3de54968
commit
544b67c7f4
1 changed files with 26 additions and 3 deletions
|
|
@ -1,13 +1,20 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { getName, getRole, logout } from 'src/services/keycloak';
|
import {
|
||||||
|
getName,
|
||||||
|
getRole,
|
||||||
|
getUserId,
|
||||||
|
getUsername,
|
||||||
|
logout,
|
||||||
|
} from 'src/services/keycloak';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import useLoader from 'stores/loader';
|
import useLoader from 'stores/loader';
|
||||||
import DrawerComponent from 'components/DrawerComponent.vue';
|
import DrawerComponent from 'components/DrawerComponent.vue';
|
||||||
import GlobalDialog from 'components/GlobalDialog.vue';
|
import GlobalDialog from 'components/GlobalDialog.vue';
|
||||||
|
import useUserStore from 'src/stores/user';
|
||||||
|
|
||||||
interface NotificationButton {
|
interface NotificationButton {
|
||||||
item: string;
|
item: string;
|
||||||
|
|
@ -76,6 +83,8 @@ const notification = ref<Notification[]>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const userImage = ref<string>();
|
||||||
|
|
||||||
function setActive(button: NotificationButton) {
|
function setActive(button: NotificationButton) {
|
||||||
notiMenu.value = notiMenu.value.map((current) => ({
|
notiMenu.value = notiMenu.value.map((current) => ({
|
||||||
item: current.item,
|
item: current.item,
|
||||||
|
|
@ -98,6 +107,18 @@ function doLogout(confirm: boolean = false) {
|
||||||
logout();
|
logout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const user = getUsername();
|
||||||
|
const uid = getUserId();
|
||||||
|
|
||||||
|
if (user === 'admin') return;
|
||||||
|
if (uid) {
|
||||||
|
const res = await useUserStore().fetchById(uid);
|
||||||
|
|
||||||
|
if (res && res.profileImageUrl) userImage.value = res.profileImageUrl;
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -226,7 +247,9 @@ function doLogout(confirm: boolean = false) {
|
||||||
class="q-pa-none"
|
class="q-pa-none"
|
||||||
style="min-width: 30px"
|
style="min-width: 30px"
|
||||||
>
|
>
|
||||||
<q-avatar class="bg-primary" />
|
<q-avatar class="bg-primary">
|
||||||
|
<img :src="userImage" />
|
||||||
|
</q-avatar>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section
|
<q-item-section
|
||||||
class="text-left q-pa-none q-px-md"
|
class="text-left q-pa-none q-px-md"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue