Skip to content

Commit

Permalink
Reroute users to general discover page for preprints/discover and pre…
Browse files Browse the repository at this point in the history
…prints/osf/discover (#2004)
  • Loading branch information
futa-ikeda authored Sep 25, 2023
1 parent 9722d5d commit deba45c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/preprints/discover/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions app/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit deba45c

Please sign in to comment.