File tree Expand file tree Collapse file tree 1 file changed +23
-8
lines changed
web-app/src/containers/SelectTutorial Expand file tree Collapse file tree 1 file changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,13 @@ interface Props {
1212
1313const LoadTutorialSummary = ( props : Props ) => {
1414 const { data, error, loading } = useFetch < TT . Tutorial > ( props . url )
15+ if ( loading ) {
16+ return < LoadingPage text = "Loading tutorial summary..." />
17+ }
18+ if ( error ) {
19+ console . log ( `Failed to load tutorial summary: ${ error } ` )
20+ return < div > Error loading summary</ div >
21+ }
1522 if ( ! data ) {
1623 return (
1724 < Dialog
@@ -24,15 +31,23 @@ const LoadTutorialSummary = (props: Props) => {
2431 No data returned for tutorial
2532 </ Dialog >
2633 )
34+ } else {
35+ // quick validation
36+ if ( ! data ?. config ?. repo ) {
37+ return (
38+ < Dialog
39+ title = "Invalid Tutorial"
40+ visible = { true }
41+ closeable = { false }
42+ footerActions = { [ 'ok' ] }
43+ onOk = { props . onReturnToSelection }
44+ >
45+ Loaded data does not match tutorial format
46+ </ Dialog >
47+ )
48+ }
49+ props . onLoadSummary ( data )
2750 }
28- if ( loading ) {
29- return < LoadingPage text = "Loading tutorial summary..." />
30- }
31- if ( error ) {
32- console . log ( `Failed to load tutorial summary: ${ error } ` )
33- return < div > Error loading summary</ div >
34- }
35- props . onLoadSummary ( data )
3651 return null
3752}
3853
You can’t perform that action at this time.
0 commit comments