Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbeb200a

Browse files
committed
rough validate tutorial format
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent34f4a5b commitbeb200a

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

‎web-app/src/containers/SelectTutorial/LoadTutorialSummary.tsx

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ interface Props {
1212

1313
constLoadTutorialSummary=(props:Props)=>{
1414
const{ data, error, loading}=useFetch<TT.Tutorial>(props.url)
15+
if(loading){
16+
return<LoadingPagetext="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<LoadingPagetext="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
returnnull
3752
}
3853

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp