Make ActionFetchResponse a class with a constructor.

This commit is contained in:
Carter Bertolini 2023-10-27 17:31:44 -04:00
parent 5f1cd195af
commit 8437515904

View File

@ -99,7 +99,7 @@ export class ActionFetchOptions {
/** /**
* Represents the response of a fetch action request. * Represents the response of a fetch action request.
*/ */
export interface ActionFetchResponse { export class ActionFetchResponse {
/** /**
* An array of `Action` objects. * An array of `Action` objects.
@ -111,6 +111,17 @@ export interface ActionFetchResponse {
* Returns a promise that resolves to an `ActionFetchResponse` object. * Returns a promise that resolves to an `ActionFetchResponse` object.
*/ */
readonly fetchNextPage?: () => Promise<ActionFetchResponse>; readonly fetchNextPage?: () => Promise<ActionFetchResponse>;
/**
* Creates an instance of the Actions class.
* @constructor
* @param actions The list of actions.
* @param fetchNextPage A function that fetches the next page of actions.
*/
constructor(actions: Action[], fetchNextPage?: () => Promise<ActionFetchResponse>) {
this.actions = actions;
this.fetchNextPage = fetchNextPage;
}
} }
/** /**