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 example: Login with API token (CSR only) #523

Merged
merged 1 commit into from
Feb 24, 2023

Conversation

flosse
Copy link
Contributor

@flosse flosse commented Feb 14, 2023

Here is an example that demonstrates how you can use leptos for SPAs that use some kind of a API token (e.g. JWT).

Motivation:
I am considering porting an existing web application whose server/API cannot be changed and SSR is not needed initially.
To get a sense of what an example looks like beyond a counter example, I chose this scenario.
Since I'm new to FRP, I'm interested in any feedback that could make the code cleaner.

@gbj
Copy link
Collaborator

gbj commented Feb 20, 2023

Hi! Could you maybe provide a little more commentary on how close you think this is to ready? It's quite a large example... I'm happy to sit down and really try to understand it but I also see various FIXME comments and things. Are you still working on it or do you want a review at this point?

@flosse
Copy link
Contributor Author

flosse commented Feb 20, 2023

Actually, it is already working but I'd not call it finished because of the three FIXME points for which I have not yet found a solution. Two of them could be phrased as questions:

  1. How to read the initial value of an input field after the browser made an autofill?
  2. How to call use_navigate outside of a Router?

The third is not really a problem but only something that feels a bit fragile.

So my suggestion is that I mark this PR as draft and I will get back to you as soon as I have solved the three issues so that I don't waste your time unnecessarily.

@flosse flosse marked this pull request as draft February 20, 2023 16:02
@flosse flosse marked this pull request as ready for review February 21, 2023 19:13
@flosse
Copy link
Contributor Author

flosse commented Feb 21, 2023

@gbj I think it's ready for review now. I expect some parts are not written in a leptops/FRP ideomatic way, but that is due to my lack of knowledge about it. So please be picky and point out anything to me that isn't pretty.

@gbj
Copy link
Collaborator

gbj commented Feb 24, 2023

Honestly this looks pretty good to me. Thanks so much for the contribution!

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