Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Updates reload
Browse files Browse the repository at this point in the history
  • Loading branch information
AnwerAR committed Aug 9, 2023
1 parent 2ccc4bf commit 932d689
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/CheckoutAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,11 @@ export default function CheckoutAPI(options?: CheckoutConfiguration) {
store.options = {} as CheckoutConfiguration;
},
reload() {
if (store.options) {
// TODO: reload list data from OPG.
if (elements && Object.keys(elements).length > 0) {
Object.keys(elements).forEach((el) => {
elements[el].update(store.options);
elements[el].reload();
});
} else {
throw new Error("Invalid configurations!");
}
},
};
Expand Down
4 changes: 3 additions & 1 deletion src/DropInComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export default function DropInComponent(name: string, options: CheckoutConfigura
logger.log("Scripts loaded and element is created");
};

// Init
/**
* Initialise drop-in-component
*/
initialise();

return {
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export interface DropInComponentInstance {
mount(node: HTMLElement | string): DropInComponentInstance;
unmount(): DropInComponentInstance;
update(updatedOptions: CheckoutConfiguration | undefined): void;
reload(): void;
}

0 comments on commit 932d689

Please sign in to comment.