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 apiFlavour to fix document POST #24

Merged
merged 2 commits into from
Dec 14, 2020
Merged

Conversation

qcasey
Copy link
Collaborator

@qcasey qcasey commented Dec 14, 2020

Hello again! This implements the apiFlavour you suggested.

  • I used the availability of the /api/token/ route when checking credentials to determine ng or not.
  • Flavour is saved in SecureStorage
  • If the saved api is incorrect when posting a new document, it'll switch to the alternate route.

Let me know what you think, and if any changes should be made.

Copy link
Owner

@bauerj bauerj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise it looks perfect!

lib/api.dart Outdated
// Try again, with paperless-ng
if (response.statusCode == 302) {
this.apiFlavour = "paperless-ng";
// Update secure storage here?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I guess it would make sense to update the storage here and in the similar line below.

@qcasey
Copy link
Collaborator Author

qcasey commented Dec 14, 2020

Just wanted to be sure!

@bauerj bauerj merged commit 48031e6 into bauerj:master Dec 14, 2020
@bauerj
Copy link
Owner

bauerj commented Dec 14, 2020

Great work, thank you!

I will test this and release an update with full paperless-ng compatibility later.

@qcasey
Copy link
Collaborator Author

qcasey commented Dec 14, 2020

And thank you!

At release we can close #18. So far I see no other compatibility issues to be flushed out.

@qcasey qcasey deleted the ng-api-check branch December 14, 2020 19:54
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

Successfully merging this pull request may close these issues.

None yet

2 participants