diff --git a/app/preprints/discover/route.ts b/app/preprints/discover/route.ts index 529014833ca..d9dea8eed50 100644 --- a/app/preprints/discover/route.ts +++ b/app/preprints/discover/route.ts @@ -2,6 +2,7 @@ import Store from '@ember-data/store'; import Route from '@ember/routing/route'; import RouterService from '@ember/routing/router-service'; import { inject as service } from '@ember/service'; +import config from 'ember-get-config'; import Theme from 'ember-osf-web/services/theme'; @@ -21,6 +22,10 @@ export default class PreprintDiscoverRoute extends Route { async model(args: any) { try { + if (!args.provider_id || args.provider_id === config.defaultProvider) { + this.router.transitionTo('search', { queryParams: { resourceType: 'Preprint' } }); + return null; + } const provider = await this.store.findRecord('preprint-provider', args.provider_id); this.theme.providerType = 'preprint'; this.theme.id = args.provider_id; diff --git a/app/router.ts b/app/router.ts index 70f4176fe25..340250c631c 100644 --- a/app/router.ts +++ b/app/router.ts @@ -26,6 +26,7 @@ Router.map(function() { this.route('dashboard', { path: '/:institution_id/dashboard' }); }); this.route('preprints', function() { + this.route('discover'); this.route('discover', { path: '/:provider_id/discover' }); }); this.route('register');