mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix user display/user popover avatar preview
This commit is contained in:
@@ -22,16 +22,12 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, PropType, computed } from '@vue/composition-api';
|
||||
import { getRootPath } from '@/utils/get-root-path';
|
||||
|
||||
type User = {
|
||||
id: number;
|
||||
avatar: {
|
||||
data: {
|
||||
thumbnails: {
|
||||
key: string;
|
||||
url: string;
|
||||
}[];
|
||||
};
|
||||
id: string;
|
||||
};
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
@@ -55,9 +51,10 @@ export default defineComponent({
|
||||
setup(props) {
|
||||
const src = computed(() => {
|
||||
if (props.value === null) return null;
|
||||
return (
|
||||
props.value?.avatar?.data?.thumbnails?.find((thumb) => thumb.key === 'system-small-crop')?.url || null
|
||||
);
|
||||
|
||||
if (props.value.avatar?.id) {
|
||||
return `${getRootPath()}assets/${props.value.avatar.id}?key=system-small-cover`;
|
||||
}
|
||||
});
|
||||
|
||||
return { src };
|
||||
|
||||
@@ -32,15 +32,14 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, watch, onUnmounted, computed } from '@vue/composition-api';
|
||||
import api from '@/api';
|
||||
import { getRootPath } from '@/utils/get-root-path';
|
||||
|
||||
type User = {
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
email: string;
|
||||
avatar: {
|
||||
data: {
|
||||
thumbnails: any[];
|
||||
};
|
||||
id: string;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -59,8 +58,9 @@ export default defineComponent({
|
||||
const avatarSrc = computed(() => {
|
||||
if (data.value === null) return null;
|
||||
|
||||
return data.value.avatar?.data?.thumbnails?.find((thumbnail) => thumbnail.key === 'system-medium-crop')
|
||||
?.url;
|
||||
if (data.value.avatar?.id) {
|
||||
return `${getRootPath()}assets/${data.value.avatar.id}?key=system-medium-cover`;
|
||||
}
|
||||
});
|
||||
|
||||
const active = ref(false);
|
||||
|
||||
Reference in New Issue
Block a user