Created
June 18, 2018 10:52
-
-
Save paulbjensen/9b500c5d1140e1acd6bcf567d290d7f1 to your computer and use it in GitHub Desktop.
The pages.js support file, part of an article for Medium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Dashboard, Organisation } = require('api/models'); | |
const pages = { | |
home: '/', | |
login: '/login', | |
signup: '/signup', | |
'forgot-password': '/forgot-password', | |
dashboard: '/dashboard', | |
account: '/account', | |
organisations: '/account/organisations', | |
'create organisation': '/account/organisations/new', | |
'change account email': '/account/email', | |
'close your account': '/account/close', | |
'change account password': '/account/password', | |
'reset-password': token => `/reset-password/${token}`, | |
'view dashboard': async name => { | |
const dashboard = await Dashboard.findOne({ name }); | |
return `/dashboards/${dashboard._id}`; | |
}, | |
'manage dashboard': async name => { | |
const dashboard = await Dashboard.findOne({ name }); | |
return `/dashboards/${dashboard._id}/manage`; | |
}, | |
'access dashboard': async name => { | |
const dashboard = await Dashboard.findOne({ name }); | |
return `/dashboards/${dashboard._id}/members`; | |
}, | |
'edit dashboard': async name => { | |
const dashboard = await Dashboard.findOne({ name }); | |
return `/dashboards/${dashboard._id}/edit`; | |
}, | |
'create dashboard': '/dashboards/new', | |
'delete dashboard': async name => { | |
const dashboard = await Dashboard.findOne({ name }); | |
return `/dashboards/${dashboard._id}/delete`; | |
}, | |
organisation: async name => { | |
const organisation = await Organisation.findOne({ name }); | |
return `/account/organisations/${organisation._id}`; | |
}, | |
'edit organisation': async name => { | |
const organisation = await Organisation.findOne({ name }); | |
return `/account/organisations/${organisation._id}/edit`; | |
}, | |
'view organisation': async name => { | |
const organisation = await Organisation.findOne({ name }); | |
return `/account/organisations/${organisation._id}`; | |
}, | |
'delete organisation': async name => { | |
const organisation = await Organisation.findOne({ name }); | |
return `/account/organisations/${organisation._id}/delete`; | |
} | |
}; | |
module.exports = pages; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment