Skip to content

A mixture of riot, page.js and es6 imports that creates an easier router for riot

Notifications You must be signed in to change notification settings

osiloke/riot-pagejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Riot Page

Lightweight router for riotjs using page.js

Simple usage

import router from 'riot-page/lib/route';
import AuthStore from 'riot-auth/lib/store';

router.route({
  name: 'login',
  path: '/login',
  container: '#main',
  tag: 'login-view',
  tpl: 'app/views/auth/components/login.tag'
})
router.route({
  name: 'logout',
  path: '/logout',
  error: (ctx, next, err) =>{
    console.log(err)
  },
  enter: (ctx) =>{
    console.log("logging out")
    AuthStore.logout()
    .then((resp) => {
      router.redirect('/')
    })
    .catch((err) => {
      console.log(err)
      router.back()
    })
  }
})

About

A mixture of riot, page.js and es6 imports that creates an easier router for riot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages