Update router.js

Corrected inverted condition on navigate function