mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac: $user
This commit is contained in:
@@ -31,8 +31,8 @@
|
||||
let profileImageInputElement: HTMLInputElement;
|
||||
|
||||
const submitHandler = async () => {
|
||||
if (name !== $user.name) {
|
||||
if (profileImageUrl === generateInitialsImage($user.name) || profileImageUrl === '') {
|
||||
if (name !== $user?.name) {
|
||||
if (profileImageUrl === generateInitialsImage($user?.name) || profileImageUrl === '') {
|
||||
profileImageUrl = generateInitialsImage(name);
|
||||
}
|
||||
}
|
||||
@@ -75,8 +75,8 @@
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
name = $user.name;
|
||||
profileImageUrl = $user.profile_image_url;
|
||||
name = $user?.name;
|
||||
profileImageUrl = $user?.profile_image_url;
|
||||
webhookUrl = $settings?.notifications?.webhook_url ?? '';
|
||||
|
||||
APIKey = await getAPIKey(localStorage.token).catch((error) => {
|
||||
@@ -214,7 +214,7 @@
|
||||
<button
|
||||
class=" text-xs text-center text-gray-800 dark:text-gray-400 rounded-full px-4 py-0.5 bg-gray-100 dark:bg-gray-850"
|
||||
on:click={async () => {
|
||||
const url = await getGravatarUrl(localStorage.token, $user.email);
|
||||
const url = await getGravatarUrl(localStorage.token, $user?.email);
|
||||
|
||||
profileImageUrl = url;
|
||||
}}>{$i18n.t('Use Gravatar')}</button
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $user.role === 'admin' || $user?.permissions.chat?.controls}
|
||||
{#if $user?.role === 'admin' || $user?.permissions.chat?.controls}
|
||||
<hr class="border-gray-100 dark:border-gray-850 my-3" />
|
||||
|
||||
<div>
|
||||
|
||||
@@ -441,7 +441,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if $user.role === 'admin'}
|
||||
{#if $user?.role === 'admin'}
|
||||
<div>
|
||||
<div class=" py-0.5 flex w-full justify-between">
|
||||
<div class=" self-center text-xs">
|
||||
|
||||
Reference in New Issue
Block a user