@fleetbase/storefront-engine
Version:
Headless Commerce & Marketplace Extension for Fleetbase
37 lines (30 loc) • 976 B
JavaScript
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class SettingsIndexRoute extends Route {
store;
currentUser;
storefront;
intl;
abilities;
hostRouter;
notifications;
queryParams = {
query: { refreshModel: false },
};
beforeModel() {
if (this.abilities.cannot('storefront view settings')) {
this.notifications.warning(this.intl.t('common.unauthorized-access'));
return this.hostRouter.transitionTo('console');
}
}
model() {
return this.store.peekRecord('store', this.currentUser.getOption('activeStorefront'));
}
afterModel(model) {
model?.loadFiles();
}
async setupController(controller) {
super.setupController(...arguments);
controller.orderConfigs = await this.store.findAll('order-config');
}
}