File tree Expand file tree Collapse file tree 3 files changed +28
-14
lines changed Expand file tree Collapse file tree 3 files changed +28
-14
lines changed Original file line number Diff line number Diff line change @@ -60,20 +60,28 @@ const options = {
6060} ;
6161
6262( async function ( ) {
63- const result = await loadClientConfig ( ) ;
63+ try {
64+ const result = await loadClientConfig ( ) ;
6465
65- const ctx = document . getElementById ( "data" ) ;
66+ const ctx = document . getElementById ( "data" ) ;
6667
67- new Chart ( ctx , {
68- type : "line" ,
69- options : options ,
70- data : {
71- labels : result . map ( ( item ) => item . labels ) ,
72- datasets : [
73- {
74- data : result . map ( ( item ) => item . data )
75- }
76- ]
77- }
78- } ) ;
68+ new Chart ( ctx , {
69+ type : "line" ,
70+ options : options ,
71+ data : {
72+ labels : result . map ( ( item ) => item . labels ) ,
73+ datasets : [
74+ {
75+ data : result . map ( ( item ) => item . data )
76+ }
77+ ]
78+ }
79+ } ) ;
80+ } catch {
81+ const body = document . querySelector ( "body" ) ;
82+ const message = document . createElement ( "p" ) ;
83+ message . classList . add ( "error" ) ;
84+ message . innerHTML = "Please run this page in a formsort flow." ;
85+ body . prepend ( message ) ;
86+ }
7987} ) ( ) ;
Original file line number Diff line number Diff line change 33 < head >
44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6+ < link rel ="stylesheet " href ="./styles.css " />
67 < title > Chart.js</ title >
78 </ head >
89 < body >
Original file line number Diff line number Diff line change 1+ p .error {
2+ color : red;
3+ font-size : 1.5em ;
4+ text-align : center;
5+ }
You can’t perform that action at this time.
0 commit comments