Skip to content

Commit

Permalink
fix lint issues, create interface for RequestParams
Browse files Browse the repository at this point in the history
  • Loading branch information
CookieCookson committed Aug 5, 2020
1 parent 8530c56 commit 215f024
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/XAPI.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Resource, GetStatementQuery, GetVoidedStatementQuery, GetStatementsQuery, StatementsResponse } from "./interfaces/XAPI";
import { Resource, GetStatementQuery, GetVoidedStatementQuery, GetStatementsQuery, StatementsResponse, RequestParams } from "./interfaces/XAPI";
import { Statement, Actor, Agent, Person } from "./interfaces/Statement";
import { About } from "./interfaces/About/About";
import { AttachmentUsages, Resources, Verbs } from "./constants";
Expand Down Expand Up @@ -251,7 +251,7 @@ export default class XAPI {
});
}

private request(resource: Resource, params: {[key: string]: any, agent?: Agent} = {}, init?: RequestInit | undefined): Promise<any> {
private request(resource: Resource, params: RequestParams = {}, init?: RequestInit | undefined): Promise<any> {
const url = this.generateURL(resource, params);
return fetch(url, {
headers: this.headers,
Expand All @@ -272,7 +272,7 @@ export default class XAPI {
});
}

private requestXMLHTTPRequest(resource: Resource, params: {[key: string]: any} = {}, initExtras?: RequestInit | undefined): Promise<any> {
private requestXMLHTTPRequest(resource: Resource, params: RequestParams = {}, initExtras?: RequestInit | undefined): Promise<any> {
return new Promise((resolve, reject) => {
const xmlRequest = new XMLHttpRequest();
const url = this.generateURL(resource, params);
Expand Down
6 changes: 6 additions & 0 deletions src/interfaces/XAPI/RequestParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Agent } from "../Statement";

export interface RequestParams {
[key: string]: any;
agent?: Agent;
}
3 changes: 2 additions & 1 deletion src/interfaces/XAPI/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./Resource";
export * from "./GetStatementQuery";
export * from "./GetStatementsQuery";
export * from "./RequestParams";
export * from "./Resource";
export * from "./StatementsResponse";

0 comments on commit 215f024

Please sign in to comment.