Skip to content

Commit

Permalink
refactor(TeacherProjectService): Convert retrieveProjectById to async…
Browse files Browse the repository at this point in the history
…/await (#1982)
  • Loading branch information
hirokiterashima authored Nov 7, 2024
1 parent b5facf6 commit aa460a6
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/assets/wise5/services/teacherProjectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,11 @@ export class TeacherProjectService extends ProjectService {
* @param projectId retrieve the project JSON with this id
* @return a promise to return the project JSON
*/
retrieveProjectById(projectId: number): any {
return this.http
.get(`/api/author/config/${projectId}`)
.toPromise()
.then((configJSON: any) => {
return this.http
.get(configJSON.projectURL)
.toPromise()
.then((projectJSON: any) => {
projectJSON.previewProjectURL = configJSON.previewProjectURL;
return projectJSON;
});
});
async retrieveProjectById(projectId: number): Promise<any> {
const configJSON: any = await this.http.get(`/api/author/config/${projectId}`).toPromise();
const projectJSON: any = await this.http.get(configJSON.projectURL).toPromise();
projectJSON.previewProjectURL = configJSON.previewProjectURL;
return projectJSON;
}

/**
Expand Down

0 comments on commit aa460a6

Please sign in to comment.