Skip to content

Commit

Permalink
Merge pull request #1581 from kleros/fix/removed-unused-dapp-variable
Browse files Browse the repository at this point in the history
fix: removed unused variable
  • Loading branch information
jaybuidl authored May 13, 2024
2 parents a431e7b + 9e226e7 commit 2240e64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
13 changes: 4 additions & 9 deletions web/netlify/functions/uploadToIPFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const parseMultipart = ({ headers, body, isBase64Encoded }) =>
bb.end();
});

const pinToFilebase = async (data: FormData, dapp: string, operation: string): Promise<Array<string>> => {
const pinToFilebase = async (data: FormData, operation: string): Promise<Array<string>> => {
const cids = new Array<string>();
for (const [_, dataElement] of Object.entries(data)) {
if (dataElement.isFile) {
Expand All @@ -68,19 +68,14 @@ const pinToFilebase = async (data: FormData, dapp: string, operation: string): P
export const handler: Handler = async (event) => {
const { queryStringParameters } = event;

if (
!queryStringParameters ||
!queryStringParameters.dapp ||
!queryStringParameters.key ||
!queryStringParameters.operation
) {
if (!queryStringParameters || !queryStringParameters.key || !queryStringParameters.operation) {
return {
statusCode: 400,
body: JSON.stringify({ message: "Invalid query parameters" }),
};
}

const { dapp, key, operation } = queryStringParameters;
const { key, operation } = queryStringParameters;

if (key !== FILEBASE_API_WRAPPER) {
return {
Expand All @@ -91,7 +86,7 @@ export const handler: Handler = async (event) => {

try {
const parsed = await parseMultipart(event);
const cids = await pinToFilebase(parsed, dapp, operation);
const cids = await pinToFilebase(parsed, operation);

return {
statusCode: 200,
Expand Down
4 changes: 2 additions & 2 deletions web/src/utils/uploadFormDataToIPFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { toast } from "react-toastify";

import { OPTIONS } from "utils/wrapWithToast";

export function uploadFormDataToIPFS(formData: FormData, operation: string = "evidence"): Promise<Response> {
export function uploadFormDataToIPFS(formData: FormData, operation = "evidence"): Promise<Response> {
return toast.promise<Response, Error>(
fetch(`/.netlify/functions/uploadToIPFS?dapp=court&key=kleros-v2&operation=${operation}`, {
fetch(`/.netlify/functions/uploadToIPFS?key=kleros-v2&operation=${operation}`, {
method: "POST",
body: formData,
}).then(async (response) => {
Expand Down

0 comments on commit 2240e64

Please sign in to comment.