File tree
Expand file treeCollapse file tree1 file changed
+23
-8
lines changed web-app/src/containers/SelectTutorial
Expand file treeCollapse file tree1 file changed
+23
-8
lines changed Original file line number | Diff line number | Diff line change |
---|
@@ -12,6 +12,13 @@ interface Props {
|
12 | 12 |
|
13 | 13 | const LoadTutorialSummary = (props: Props) => {
|
14 | 14 | 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 | +} |
15 | 22 | if (!data) {
|
16 | 23 | return (
|
17 | 24 | <Dialog
|
@@ -24,15 +31,23 @@ const LoadTutorialSummary = (props: Props) => {
|
24 | 31 | No data returned for tutorial
|
25 | 32 | </Dialog>
|
26 | 33 | )
|
| 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) |
27 | 50 | }
|
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) |
36 | 51 | return null
|
37 | 52 | }
|
38 | 53 |
|
|
You can’t perform that action at this time.
0 commit comments