enh: include profile image during user import

This commit is contained in:
Timothy Jaeryang Baek 2025-05-05 16:17:20 +04:00
parent abdde10b74
commit 33c206c15c
3 changed files with 9 additions and 5 deletions

View File

@ -354,7 +354,8 @@ export const addUser = async (
name: string, name: string,
email: string, email: string,
password: string, password: string,
role: string = 'pending' role: string = 'pending',
profile_image_url: null | string = null
) => { ) => {
let error = null; let error = null;
@ -368,7 +369,8 @@ export const addUser = async (
name: name, name: name,
email: email, email: email,
password: password, password: password,
role: role role: role,
...(profile_image_url && { profile_image_url: profile_image_url })
}) })
}) })
.then(async (res) => { .then(async (res) => {

View File

@ -137,7 +137,6 @@
on:confirm={() => { on:confirm={() => {
onUpdateRole(selectedUser); onUpdateRole(selectedUser);
}} }}
title={$i18n.t('Update User Role')}
message={$i18n.t(`Are you sure you want to update this user\'s role to **{{ROLE}}**?`, { message={$i18n.t(`Are you sure you want to update this user\'s role to **{{ROLE}}**?`, {
ROLE: ROLE:
selectedUser?.role === 'user' selectedUser?.role === 'user'

View File

@ -7,6 +7,7 @@
import { WEBUI_BASE_URL } from '$lib/constants'; import { WEBUI_BASE_URL } from '$lib/constants';
import Modal from '$lib/components/common/Modal.svelte'; import Modal from '$lib/components/common/Modal.svelte';
import { generateInitialsImage } from '$lib/utils';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
@ -47,7 +48,8 @@
_user.name, _user.name,
_user.email, _user.email,
_user.password, _user.password,
_user.role _user.role,
generateInitialsImage(_user.name)
).catch((error) => { ).catch((error) => {
toast.error(`${error}`); toast.error(`${error}`);
}); });
@ -83,7 +85,8 @@
columns[0], columns[0],
columns[1], columns[1],
columns[2], columns[2],
columns[3].toLowerCase() columns[3].toLowerCase(),
generateInitialsImage(columns[0])
).catch((error) => { ).catch((error) => {
toast.error(`Row ${idx + 1}: ${error}`); toast.error(`Row ${idx + 1}: ${error}`);
return null; return null;