Skip to content

Commit

Permalink
Added custom sound error
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-malviya15 committed Feb 17, 2022
1 parent 3a47726 commit 25c1715
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/views/admin/customSounds/AddCustomSound.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function AddCustomSound({ goToNew, close, onChange, ...props }) {
return soundId;
}
validation.forEach((error) => {
throw new Error({
dispatchToastMessage({
type: 'error',
message: t('error-the-field-is-required', { field: t(error) }),
});
Expand Down
5 changes: 2 additions & 3 deletions client/views/admin/customSounds/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ export function validate(soundData, soundFile) {
}

export function createSoundData(soundFile, name = '', previousData) {
const soundData = {
extension: soundFile.name.split('.').pop(),
};
const soundData = {};

if (previousData) {
soundData._id = previousData._id;
soundData.previousName = previousData.previousName;
soundData.previousSound = previousData.previousSound;
soundData.extension = soundFile.name.split('.').pop();
soundData.previousExtension = previousData.previousSound.extension;
soundData.name = name;
soundData.newFile = false;
Expand Down

0 comments on commit 25c1715

Please sign in to comment.