mirror of
https://github.com/directus/directus.git
synced 2026-02-11 01:05:00 -05:00
19 lines
357 B
TypeScript
19 lines
357 B
TypeScript
import { User } from '@/types';
|
|
import { i18n } from '@/lang';
|
|
|
|
export function userName(user: Partial<User>): string {
|
|
if (user.first_name && user.last_name) {
|
|
return `${user.first_name} ${user.last_name}`;
|
|
}
|
|
|
|
if (user.first_name) {
|
|
return user.first_name;
|
|
}
|
|
|
|
if (user.email) {
|
|
return user.email;
|
|
}
|
|
|
|
return i18n.t('unknown_user') as string;
|
|
}
|