Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to reload/poll for changes from resources #134

Open
easen-amp opened this issue Jan 27, 2023 · 0 comments
Open

Unable to reload/poll for changes from resources #134

easen-amp opened this issue Jan 27, 2023 · 0 comments

Comments

@easen-amp
Copy link
Member

Description

Certain resource actions only become available when other actions have completed, e.g. you can only delete an Event once all the Edition's have been unscheduled.

It would be nice to have a method on the resource to reload themselves by a HTTP request using the self HAL link.

await edition.related.unschedule();
await event.related.delete(); // will throw "The delete action is not available, ensure you have permission to perform this action" as the unscheduling is being processed within DC.

Proposal

Option 1

All resources had a reload() method, I could poll until the HAL link is returned...

edition.related.unschedule();

while(!event._links['delete']) {
  event = event.reload(); // <-- new method
}
event.related.delete();

Option 2

Expose a method that poll's DC and returns when the data has changed

edition.related.unschedule();

const updatedEvent = await event.pollForChanges();

updatedEvent.related.delete();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant