@thetechfossil/auth2 1.2.11 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.components.js +9 -1
- package/dist/index.components.js.map +1 -1
- package/dist/index.components.mjs +9 -1
- package/dist/index.components.mjs.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/dist/index.next.js +9 -1
- package/dist/index.next.js.map +1 -1
- package/dist/index.next.mjs +9 -1
- package/dist/index.next.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/index.next.server.d.ts +0 -272
package/dist/index.mjs
CHANGED
|
@@ -4487,7 +4487,15 @@ var AvatarUploader = ({
|
|
|
4487
4487
|
const handleSelect = async (image) => {
|
|
4488
4488
|
setUploading(true);
|
|
4489
4489
|
try {
|
|
4490
|
-
const
|
|
4490
|
+
const proxyUrl = `${upfilesConfig.baseUrl}/api/download?fileKey=${encodeURIComponent(image.key)}`;
|
|
4491
|
+
const response = await fetch(proxyUrl, {
|
|
4492
|
+
headers: upfilesConfig.apiKey ? {
|
|
4493
|
+
[upfilesConfig.apiKeyHeader || "authorization"]: upfilesConfig.apiKey.startsWith("upk_") ? `Bearer ${upfilesConfig.apiKey}` : upfilesConfig.apiKey
|
|
4494
|
+
} : {}
|
|
4495
|
+
});
|
|
4496
|
+
if (!response.ok) {
|
|
4497
|
+
throw new Error("Failed to fetch image");
|
|
4498
|
+
}
|
|
4491
4499
|
const blob = await response.blob();
|
|
4492
4500
|
const file = new File([blob], image.originalName, { type: image.contentType });
|
|
4493
4501
|
const result = await uploadAndUpdateAvatar(file);
|