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

Add Background Sync examples, integrate API Platform #11

Open
tacman opened this issue Mar 6, 2024 · 0 comments
Open

Add Background Sync examples, integrate API Platform #11

tacman opened this issue Mar 6, 2024 · 0 comments

Comments

@tacman
Copy link
Contributor

tacman commented Mar 6, 2024

I've been thinking about the "Add A Task" form and how to handle it offline.

We could simply disable (or completely hide) the form when the navigator tells us we're offline. It's crude and basic, but would get rid of the error when we try to post.

Better would be to defer the POST. First, we'd need to refactor the submit button to a javascript call that does the submit. If it failed, we could cache the POST request and send it in the background. I have no idea how to do that, but it seems possible.

Continuing to brainstorm, though, instead of the background process submitting the POST request to the controller endpoint as we would with a regular form submit, we could submit it to an API Platform endpoint. While this is somewhat more complicated to set up, it would mean that we were using the server to generate mostly static HTML and using the API for anything involving data. This seems like it'd be the better way to create dynamic apps.

There was a SymfonyCast tutorial a few years ago that walked through this, though it didn't use API Platform at the time.

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