error handling levels

This commit is contained in:
realaravinth
2021-06-29 23:20:54 +05:30
parent f10741d09f
commit 96fafb339c
5 changed files with 15 additions and 4 deletions

View File

@@ -19,6 +19,8 @@ import CONST from '../const';
import getLevelFields from './getLevelFields';
import {LEVELS} from './index';
import createError from '../../../../../components/error';
/** on-change event handler to update level */
const updateLevel = (e: Event) => {
const target = <HTMLInputElement>e.target;
@@ -41,7 +43,7 @@ const updateLevel = (e: Event) => {
const updatedLevel = getLevelFields(level);
LEVELS.update(updatedLevel, level);
} catch (e) {
alert(e);
createError(e);
}
};