Skip to content

Commit

Permalink
specify public/private methods and props
Browse files Browse the repository at this point in the history
  • Loading branch information
foomoon committed Jan 7, 2024
1 parent f03a289 commit 52bbe9b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/lib/fetchwrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export default class FetchWrapper {
this.timeout = timeout;
}

addHeaders(newHeaders: Record<string, string>) {
public addHeaders(newHeaders: Record<string, string>) {
this.defaults.headers = { ...this.defaults.headers, ...newHeaders };
}

async request(
public async request(
endpoint: string,
options: RequestInit = {}
): Promise<FetchResponse> {
Expand All @@ -39,11 +39,14 @@ export default class FetchWrapper {
}
}

async get(endpoint: string, options: RequestInit = {}): Promise<Response> {
public async get(
endpoint: string,
options: RequestInit = {}
): Promise<Response> {
return this.request(endpoint, { ...options, method: "GET" });
}

async post(
public async post(
endpoint: string,
body: any,
options: RequestInit = {}
Expand All @@ -52,14 +55,14 @@ export default class FetchWrapper {
return this.request(endpoint, { ...options, method: "POST", body });
}

async delete(endpoint: string, data: any): Promise<Response> {
public async delete(endpoint: string, data: any): Promise<Response> {
return this.request(endpoint, {
method: "DELETE",
body: JSON.stringify(data),
});
}

async put(
public async put(
endpoint: string,
body: any,
options: RequestInit = {}
Expand Down

0 comments on commit 52bbe9b

Please sign in to comment.