Skip to content

Commit 672645e

Browse files
committed
logs: log the file and its contents
1 parent 1c19cc5 commit 672645e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/store/main.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2390,6 +2390,26 @@ export class MainStore {
23902390
try {
23912391
if (!uiStore.meInfo) return null;
23922392
const info = uiStore.meInfo;
2393+
2394+
// Inspect FormData
2395+
for (const [key, value] of body.entries()) {
2396+
console.log(`${key}:`, value);
2397+
if (value instanceof File) {
2398+
console.log(`File name: ${value.name}, Size: ${value.size}, Type: ${value.type}`);
2399+
2400+
// Read file content
2401+
const reader = new FileReader();
2402+
reader.onload = () => {
2403+
console.log(`File content:`, reader.result);
2404+
};
2405+
reader.onerror = () => {
2406+
console.log(`Error reading file:`, reader.error);
2407+
};
2408+
// Read as text, data URL, or other format depending on file type
2409+
reader.readAsText(value); // or readAsDataURL for images, etc.
2410+
}
2411+
}
2412+
23932413
const r: any = await fetch(`${TribesURL}/meme_upload`, {
23942414
method: 'POST',
23952415
mode: 'cors',

0 commit comments

Comments
 (0)