UNPKG

@fleetbase/storefront-engine

Version:

Headless Commerce & Marketplace Extension for Fleetbase

31 lines (26 loc) 929 B
import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; export default class NetworksIndexRoute extends Route { @service store; @service intl; @service abilities; @service hostRouter; @service notifications; queryParams = { page: { refreshModel: true }, limit: { refreshModel: true }, sort: { refreshModel: true }, query: { refreshModel: true }, created_at: { refreshModel: true }, updated_at: { refreshModel: true }, }; beforeModel() { if (this.abilities.cannot('storefront list network')) { this.notifications.warning(this.intl.t('common.unauthorized-access')); return this.hostRouter.transitionTo('console.storefront'); } } model(params) { return this.store.query('network', { with_gateways: 1, with_notification_channels: 1, ...params }); } }