Skip to content

Commit

Permalink
chore: rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Sep 19, 2023
1 parent 958da38 commit e36838c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const PINEAPPLE_URL = 'https://pineapple.fyi';
const timeout = 10e3;

export async function pin(json: any, url = PINEAPPLE_URL) {
const init = {
const options = {
method: 'POST',
headers: {
Accept: 'application/json',
Expand All @@ -19,18 +19,18 @@ export async function pin(json: any, url = PINEAPPLE_URL) {
timeout
};

return sendRequest(url, init);
return sendRequest(url, options);
}

export async function upload(body: any, url = `${PINEAPPLE_URL}/upload`) {
const init = { method: 'POST', body, timeout };
const options = { method: 'POST', body, timeout };

return sendRequest(url, init);
return sendRequest(url, options);
}

async function sendRequest(url: string, init: any) {
async function sendRequest(url: string, options: any) {
try {
return (await fetch(url, init)).result;
return (await fetch(url, options)).result;
} catch (e: any) {
return { error: e.data?.error || { code: e.status, message: e.statusText } };
}
Expand Down

0 comments on commit e36838c

Please sign in to comment.