Improved file uploader; uploads from the library can be selected

This commit is contained in:
Mawoka
2023-06-11 20:10:53 +02:00
parent 7fb71edc61
commit 9c0058f1c3
6 changed files with 183 additions and 45 deletions
+2 -17
View File
@@ -4,26 +4,11 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import type { PageLoad } from './$types';
export interface ImageData {
id: string;
uploaded_at: string;
mime_type: string;
hash?: string;
size?: number;
deleted_at?: string;
alt_text?: string;
filename?: string;
thumbhash?: string;
server?: string;
imported: boolean;
quizzes: { id: string }[];
quiztivities: { id: string }[];
}
import type { PrivateImageData } from '$lib/quiz_types';
export const load = (async ({ fetch }) => {
const res = await fetch('/api/v1/storage/list');
const json: ImageData[] = await res.json();
const json: PrivateImageData[] = await res.json();
return {
images: json
};