Mutsu-Studio-Cloud / src /lib /cloudUtils.ts
SeeMoon1's picture
Final Release: Mutsu Cloud Protocol
d36ee3d
Raw History Blame Contribute Delete
685 Bytes
export const uploadImageToCloud = async (base64Data: string, meta: any) => {
try {
console.log("💾 Saving to Local Storage...");
const res = await fetch("/api/upload", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ base64: base64Data })
});
if (!res.ok) {
throw new Error(`Upload API Error: ${res.statusText}`);
}
const data = await res.json();
console.log("✅ Local Save Success:", data.url);
return data.url;
} catch (e) {
console.error("Local Upload Failed:", e);
return null;
}
};