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

Improvement on the Adapter part of the README #341

Open
Dainii opened this issue Jan 8, 2025 · 0 comments
Open

Improvement on the Adapter part of the README #341

Dainii opened this issue Jan 8, 2025 · 0 comments

Comments

@Dainii
Copy link

Dainii commented Jan 8, 2025

Hello !

Thank you for this addon.

Just a quick feedback, when implementing this on my application, I had some issue doing request with ember-data. It turns out that the handleResponse(status) function suggested never returns the payload to ember-data, generating error like "Error while processing route: authenticated.model You made a 'findAll' request for 'model' records, but the adapter's response did not have any data".

I changed it to

handleResponse(status, headers, payload, requestData) {
  if (status === 401 && this.session.isAuthenticated) {
    this.session.invalidate();
  }

  return super.handleResponse(status, headers, payload, requestData);
}

I'm no expert in Javascript, so maybe there is a better way to do this.

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