Additional saga for purpose like onLeave
kuy opened this issue · comments
Yuki Kodama commented
const routes = {
'posts/new': [function* enter() {
// onEnter
}, function* leave() {
// onLeave
}],
};
Yuki Kodama commented
Working with nested routes.
const routes = {
'/admin': {
[ENTER]: function* auth() {
// Authentication
},
'/dashboard': Dashboard,
'/posts': {
[ENTER]: ...,
'/new': PostsNew,
},
[LEAVE]: ...
}
};
OR
const routes = {
'/admin': [function* enter() {
// Authentication
}, {
'/dashboard': Dashboard,
'/posts': {
[ENTER]: ...,
'/new': PostsNew,
}, function* leave() {
// Cleanup
}]
};