From 6dc4b0f70d9d62f6fd5f3bc404b2eeab68094050 Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 5 Sep 2024 09:58:29 -0400 Subject: [PATCH] chore: Refactor upload response based on new API response --- src/core/uploads/base64.ts | 5 +++-- src/core/uploads/file.ts | 5 +++-- src/core/uploads/fileArray.ts | 5 +++-- src/core/uploads/json.ts | 5 +++-- src/core/uploads/url.ts | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/core/uploads/base64.ts b/src/core/uploads/base64.ts index ed5879b..f793568 100644 --- a/src/core/uploads/base64.ts +++ b/src/core/uploads/base64.ts @@ -124,8 +124,9 @@ export const uploadBase64 = async ( ); } - const res: UploadResponse = await request.json(); - return res; + const res = await request.json(); + const resData: UploadResponse = res.data; + return resData; } catch (error) { if (error instanceof PinataError) { throw error; diff --git a/src/core/uploads/file.ts b/src/core/uploads/file.ts index d55830d..6246116 100644 --- a/src/core/uploads/file.ts +++ b/src/core/uploads/file.ts @@ -114,8 +114,9 @@ export const uploadFile = async ( errorData, ); } - const res: UploadResponse = await request.json(); - return res; + const res = await request.json(); + const resData: UploadResponse = res.data; + return resData; } catch (error) { if (error instanceof PinataError) { throw error; diff --git a/src/core/uploads/fileArray.ts b/src/core/uploads/fileArray.ts index 06230f4..94e92b8 100644 --- a/src/core/uploads/fileArray.ts +++ b/src/core/uploads/fileArray.ts @@ -122,8 +122,9 @@ export const uploadFileArray = async ( ); } - const res: UploadResponse = await request.json(); - return res; + const res = await request.json(); + const resData: UploadResponse = res.data; + return resData; } catch (error) { if (error instanceof PinataError) { throw error; diff --git a/src/core/uploads/json.ts b/src/core/uploads/json.ts index 0e3b02c..b8cbf9b 100644 --- a/src/core/uploads/json.ts +++ b/src/core/uploads/json.ts @@ -114,8 +114,9 @@ export const uploadJson = async ( ); } - const res: UploadResponse = await request.json(); - return res; + const res = await request.json(); + const resData: UploadResponse = res.data; + return resData; } catch (error) { if (error instanceof PinataError) { throw error; diff --git a/src/core/uploads/url.ts b/src/core/uploads/url.ts index bc10c21..63971ce 100644 --- a/src/core/uploads/url.ts +++ b/src/core/uploads/url.ts @@ -135,8 +135,9 @@ export const uploadUrl = async ( ); } - const res: UploadResponse = await request.json(); - return res; + const res = await request.json(); + const resData: UploadResponse = res.data; + return resData; } catch (error) { if (error instanceof PinataError) { throw error;