mirror of
https://github.com/immich-app/immich.git
synced 2025-01-01 08:31:59 +00:00
fix(web): multi file upload in albums (#10190)
This commit is contained in:
parent
9e5c52b7b7
commit
6260caf649
1 changed files with 3 additions and 3 deletions
|
@ -31,8 +31,8 @@ type FileUploadParam = { multiple?: boolean } & (
|
||||||
| { albumId?: string; assetId?: never }
|
| { albumId?: string; assetId?: never }
|
||||||
| { albumId?: never; assetId?: string }
|
| { albumId?: never; assetId?: string }
|
||||||
);
|
);
|
||||||
export const openFileUploadDialog = async (options?: FileUploadParam) => {
|
export const openFileUploadDialog = async (options: FileUploadParam = {}) => {
|
||||||
const { albumId, multiple, assetId } = options || { multiple: true };
|
const { albumId, multiple = true, assetId } = options;
|
||||||
const extensions = await getExtensions();
|
const extensions = await getExtensions();
|
||||||
|
|
||||||
return new Promise<(string | undefined)[]>((resolve, reject) => {
|
return new Promise<(string | undefined)[]>((resolve, reject) => {
|
||||||
|
@ -40,7 +40,7 @@ export const openFileUploadDialog = async (options?: FileUploadParam) => {
|
||||||
const fileSelector = document.createElement('input');
|
const fileSelector = document.createElement('input');
|
||||||
|
|
||||||
fileSelector.type = 'file';
|
fileSelector.type = 'file';
|
||||||
fileSelector.multiple = !!multiple;
|
fileSelector.multiple = multiple;
|
||||||
fileSelector.accept = extensions.join(',');
|
fileSelector.accept = extensions.join(',');
|
||||||
fileSelector.addEventListener('change', (e: Event) => {
|
fileSelector.addEventListener('change', (e: Event) => {
|
||||||
const target = e.target as HTMLInputElement;
|
const target = e.target as HTMLInputElement;
|
||||||
|
|
Loading…
Reference in a new issue