Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(route): 2488 empty page when param is missing
Browse files Browse the repository at this point in the history
Closes #2488
  • Loading branch information
Terry Lin authored and Terry Lin committed Jun 1, 2016
1 parent 3aab1dd commit c7c0c44
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/scripts/annotations/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ module ngApp.annotations {
templateUrl: "annotations/templates/annotation.html",
resolve: {
annotation: ($stateParams: ng.ui.IStateParamsService, AnnotationsService: IAnnotationsService): ng.IPromise<IAnnotation> => {
if (! $stateParams.annotationId) {
throw Error('Missing route parameter: annotationId. Redirecting to 404 page.');
}
return AnnotationsService.getAnnotation($stateParams["annotationId"],
{
fields: [
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/files/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module ngApp.files {
templateUrl: "files/templates/file.html",
resolve: {
file: ($stateParams: ng.ui.IStateParamsService, FilesService: IFilesService): ng.IPromise<IFile> => {
if (! $stateParams.fileId) {
throw Error('Missing route parameter: fileId. Redirecting to 404 page.');
}
return FilesService.getFile($stateParams["fileId"], {
expand: [
"metadata_files",
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/participant/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module ngApp.participants {
templateUrl: "participant/templates/participant.html",
resolve: {
participant: ($stateParams: ng.ui.IStateParamsService, ParticipantsService: IParticipantsService): ng.IPromise<IParticipant> => {
if (! $stateParams.caseId) {
throw Error('Missing route parameter: caseId. Redirecting to 404 page.');
}
return ParticipantsService.getParticipant($stateParams["caseId"], {
fields: [
"case_id",
Expand Down
3 changes: 3 additions & 0 deletions app/scripts/projects/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ module ngApp.projects {
templateUrl: "projects/templates/project.html",
resolve: {
project: ($stateParams: ng.ui.IStateParamsService, ProjectsService: IProjectsService): ng.IPromise<IProject> => {
if (! $stateParams.projectId) {
throw Error('Missing route parameter: projectId. Redirecting to 404 page.');
}
return ProjectsService.getProject($stateParams["projectId"], {
fields: [
"name",
Expand Down

0 comments on commit c7c0c44

Please sign in to comment.