@thetechfossil/auth2 1.2.11 → 1.2.13
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 +3 -3
package/dist/index.js
CHANGED
|
@@ -4493,7 +4493,15 @@ var AvatarUploader = ({
|
|
|
4493
4493
|
const handleSelect = async (image) => {
|
|
4494
4494
|
setUploading(true);
|
|
4495
4495
|
try {
|
|
4496
|
-
const
|
|
4496
|
+
const proxyUrl = `${upfilesConfig.baseUrl}/api/download?fileKey=${encodeURIComponent(image.key)}`;
|
|
4497
|
+
const response = await fetch(proxyUrl, {
|
|
4498
|
+
headers: upfilesConfig.apiKey ? {
|
|
4499
|
+
[upfilesConfig.apiKeyHeader || "authorization"]: upfilesConfig.apiKey.startsWith("upk_") ? `Bearer ${upfilesConfig.apiKey}` : upfilesConfig.apiKey
|
|
4500
|
+
} : {}
|
|
4501
|
+
});
|
|
4502
|
+
if (!response.ok) {
|
|
4503
|
+
throw new Error("Failed to fetch image");
|
|
4504
|
+
}
|
|
4497
4505
|
const blob = await response.blob();
|
|
4498
4506
|
const file = new File([blob], image.originalName, { type: image.contentType });
|
|
4499
4507
|
const result = await uploadAndUpdateAvatar(file);
|