File tree 1 file changed +10
-1
lines changed
src/dashboard/Data/Playground
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import ParseApp from 'lib/ParseApp';
7
7
import CodeEditor from 'components/CodeEditor/CodeEditor.react' ;
8
8
import Button from 'components/Button/Button.react' ;
9
9
import SaveButton from 'components/SaveButton/SaveButton.react' ;
10
+ import Swal from 'sweetalert2' ;
10
11
import Toolbar from 'components/Toolbar/Toolbar.react' ;
11
12
12
13
import styles from './Playground.scss' ;
@@ -106,9 +107,17 @@ export default class Playground extends Component {
106
107
107
108
saveCode ( ) {
108
109
try {
109
- this . setState ( { saving : true , savingState : SaveButton . States . SAVING } ) ;
110
110
const code = this . editor . value ;
111
+ if ( ! code ) {
112
+ Swal . fire ( {
113
+ title : 'Couldn\'t save latest changes' ,
114
+ text : 'Please add some code before saving' ,
115
+ type : 'error' ,
116
+ } ) ;
117
+ return this . setState ( { code } ) ;
118
+ }
111
119
120
+ this . setState ( { saving : true , savingState : SaveButton . States . SAVING } ) ;
112
121
window . localStorage . setItem ( this . localKey , code ) ;
113
122
this . setState ( {
114
123
code,
You can’t perform that action at this time.
0 commit comments