File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/dashboard/Data/Playground Expand file tree Collapse file tree 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';
77import CodeEditor from 'components/CodeEditor/CodeEditor.react' ;
88import Button from 'components/Button/Button.react' ;
99import SaveButton from 'components/SaveButton/SaveButton.react' ;
10+ import Swal from 'sweetalert2' ;
1011import Toolbar from 'components/Toolbar/Toolbar.react' ;
1112
1213import styles from './Playground.scss' ;
@@ -106,9 +107,17 @@ export default class Playground extends Component {
106107
107108 saveCode ( ) {
108109 try {
109- this . setState ( { saving : true , savingState : SaveButton . States . SAVING } ) ;
110110 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+ }
111119
120+ this . setState ( { saving : true , savingState : SaveButton . States . SAVING } ) ;
112121 window . localStorage . setItem ( this . localKey , code ) ;
113122 this . setState ( {
114123 code,
You can’t perform that action at this time.
0 commit comments