Comments (6)
After some reflecting: perhaps the right place to put this sort of functionality would be in the routing. But that would necessarily make the router more complex, which may be antithetical to the principles of hyperapp.
Either way, I'm still curious how (any of) you would solve the basic problem of authenticated access to specific routes.
from hyperapp.
Do you have an example you could share?
from hyperapp.
sure thing. Does this code-pen clarify things? http://codepen.io/anon/pen/jyQWpv
from hyperapp.
Actually, I think I'm going to close this one.
I was hell-bent on keeping the login page in it's own /login
route (rather than as a conditionally rendered view), but the more I think about it, the less important that login-route seems. So I withdraw the question.
from hyperapp.
@zaceno Please share your findings back with us when, and if you do finish the project you're talking about. 🙏
from hyperapp.
Will do!
I am actually porting (incrementally) an app I've already written with vue.js to hyperapp (just for fun :) ). In vue, I was using the approach of having a special route for the login page, and a guard for the authenticated pages (as I was trying to do in my examples above).
The more I thought about it, I realized that the solution I have in Vue, hinges on the fact that the Vue-router supports a kind of nested component routing (where for example a route '/A/B' means "render parent view A, with the child view B, and route '/A/C' means "render parent view A with child view C")
Since the hyperapp router is intentionally much more simplistic, I undertand I should avoid too much routing-voodoo as I port over. For different tools, solve the same problem in different ways, each appropriate to the respective tool :)
For now, I'll go with conditional rendering. But if I happen to have any neat ideas, I'll be sure to submit a PR.
from hyperapp.
Related Issues (20)
- JSX fails if no props are given HOT 6
- A way to insert raw Html HOT 1
- TypeError: can't access property 0, newSubs is null, when setting the state to undefined. HOT 4
- Issue with null-vnodes HOT 1
- prevent rerender node HOT 2
- The dispatch initializer ends in an endless loop on init when dispatching any action HOT 7
- Injected classes gets removed when using object/array to define class props HOT 1
- hyperapp version HOT 3
- Memo Data Gotcha HOT 5
- Confusing doc for actions -> wrapped actions HOT 5
- Passing arguments to init HOT 4
- [Question] Headless mode is still possible? HOT 1
- Destroying a child app HOT 8
- @hyperapp/html: use a Proxy? HOT 9
- Actions returning other Actions HOT 5
- Compile template tag to hyperscript HOT 17
- A challenge to hyperapp community HOT 1
- Has 2.0 been dropped from development? HOT 3
- oldSub[2] is not a function HOT 3
- Cannot read properties of null (reading 'length') HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hyperapp.