Created
July 4, 2016 08:42
-
-
Save asido/1a95df961c61b876de85753274cbf568 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public fetchMaterial(materialId: number): void { | |
IsSet(materialId); | |
this.appState.dispatch({ type: StateActions.SET_LOADING, payload: true }); | |
this.apiService.Publications().MaterialsOf({ Id: materialId }) | |
.Search({ $top: 1, $select: "Text" }) | |
.do(() => this.appState.dispatch({ type: StateActions.SET_LOADING, payload: false })) | |
.subscribe(response => { | |
this.appState.dispatch({ | |
type: StateActions.PROCESS_CONTENT, | |
payload: <ProcessContentArgs>{ | |
content: response.value[0].Text, | |
knownTerms: this.termsService.getKnown(), | |
ignoredTerms: this.termsService.getIgnored(), | |
shelvedTerms: this.termsService.getShelved(), | |
flashcardedTerms: this.flashcardsService.getAllFlashcards(), | |
flashcardedPhrases: this.flashcardsService.getPhrases() | |
} | |
}); | |
}, error => Materialize.toast(`Failed to load the material :(`, 60000)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment