Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Refactor upload response based on new API response #27

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/core/uploads/base64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/core/uploads/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/core/uploads/fileArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/core/uploads/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ export const uploadJson = async <T extends JsonBody>(
);
}

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;
Expand Down
5 changes: 3 additions & 2 deletions src/core/uploads/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down