fleet/website/api/controllers/customers/view-dashboard.js
eashaw 645490019e
Update customer portal styles (#3663)
* Add more specific error for login.js

* fix typo, add can I use comment

* adjust padding for quote preview

* update quoted price when number of hosts change

* update footer link layout

* fix lint error
2022-01-17 14:26:40 +09:00

44 lines
865 B
JavaScript
Vendored

module.exports = {
friendlyName: 'View dashboard',
description: 'Display "Dashboard" page.',
exits: {
success: {
viewTemplatePath: 'pages/customers/dashboard'
},
redirect: {
description: 'The requesting user does not have a subscription, redirecting to the new license page.',
responseType: 'redirect',
},
},
fn: async function () {
// Get subscription Info
let thisSubscription = await Subscription.findOne({user: this.req.me.id});
// If the user does not have a subscription, then help them subscribe.
if(!thisSubscription) {
throw {redirect: '/customers/new-license'};
}
// Respond with view.
return {
stripePublishableKey: sails.config.custom.enableBillingFeatures ? sails.config.custom.stripePublishableKey : undefined,
thisSubscription,
};
}
};