mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-15 06:09:58 +08:00
Use swal to show error message when adding players
This commit is contained in:
parent
b7a2d368f7
commit
6926ae21ff
@ -717,7 +717,7 @@ describe('tests for "player" module', () => {
|
||||
expect(document.getElementById('1')).toBeNull();
|
||||
|
||||
await deletePlayer(1);
|
||||
expect(toastr.warning).toBeCalledWith('warning');
|
||||
expect(swal).toBeCalledWith({ type: 'warning', html: 'warning' });
|
||||
|
||||
await deletePlayer(1);
|
||||
expect(showAjaxError).toBeCalled();
|
||||
@ -759,7 +759,7 @@ describe('tests for "player" module', () => {
|
||||
expect(modal).toBeCalled();
|
||||
|
||||
await addNewPlayer();
|
||||
expect(toastr.warning).toBeCalledWith('warning');
|
||||
expect(swal).toBeCalledWith({ type: 'warning', html: 'warning' });
|
||||
|
||||
await addNewPlayer();
|
||||
expect(showAjaxError).toBeCalled();
|
||||
|
@ -208,7 +208,7 @@ async function deletePlayer(pid) {
|
||||
});
|
||||
$(`tr#${pid}`).remove();
|
||||
} else {
|
||||
toastr.warning(msg);
|
||||
swal({ type: 'warning', html: msg });
|
||||
}
|
||||
} catch (error) {
|
||||
showAjaxError(error);
|
||||
@ -225,14 +225,12 @@ async function addNewPlayer() {
|
||||
});
|
||||
|
||||
if (errno === 0) {
|
||||
swal({
|
||||
type: 'success',
|
||||
html: msg
|
||||
}).then(() => location.reload());
|
||||
await swal({ type: 'success', html: msg });
|
||||
|
||||
$('#modal-add-player').modal('hide');
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.warning(msg);
|
||||
swal({ type: 'warning', html: msg });
|
||||
}
|
||||
} catch (error) {
|
||||
showAjaxError(error);
|
||||
|
Loading…
Reference in New Issue
Block a user