|
|
@@ -36,57 +36,3 @@ export const toastWarningOption: ToastOptions = {
|
|
|
export const toastWarning = (content: ToastContent, option: ToastOptions = toastWarningOption): void => {
|
|
|
toastrLegacy.warning(content, option);
|
|
|
};
|
|
|
-
|
|
|
-// TODO: Delete legacy toastr if new toastr design completed.
|
|
|
-// see: https://redmine.weseek.co.jp/issues/117819
|
|
|
-const toastrLegacyOption = {
|
|
|
- error: {
|
|
|
- closeButton: true,
|
|
|
- progressBar: true,
|
|
|
- newestOnTop: false,
|
|
|
- showDuration: '100',
|
|
|
- hideDuration: '100',
|
|
|
- timeOut: '0',
|
|
|
- },
|
|
|
- success: {
|
|
|
- closeButton: true,
|
|
|
- progressBar: true,
|
|
|
- newestOnTop: false,
|
|
|
- showDuration: '100',
|
|
|
- hideDuration: '100',
|
|
|
- timeOut: '3000',
|
|
|
- },
|
|
|
- warning: {
|
|
|
- closeButton: true,
|
|
|
- progressBar: true,
|
|
|
- newestOnTop: false,
|
|
|
- showDuration: '100',
|
|
|
- hideDuration: '100',
|
|
|
- timeOut: '6000',
|
|
|
- },
|
|
|
-};
|
|
|
-
|
|
|
-export const legacy = {
|
|
|
- // accepts both a single error and an array of errors
|
|
|
- toastError: (err: string | Error | Error[], header = 'Error', option = toastrLegacyOption.error): void => {
|
|
|
- const errs = toArrayIfNot(err);
|
|
|
-
|
|
|
- if (errs.length === 0) {
|
|
|
- toastrLegacy.error('', header);
|
|
|
- }
|
|
|
-
|
|
|
- for (const err of errs) {
|
|
|
- const message = (typeof err === 'string') ? err : err.message;
|
|
|
- toastrLegacy.error(message || err, header, option);
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- // only accepts a single item
|
|
|
- toastSuccess: (body: string, header = 'Success', option = toastrLegacyOption.success): void => {
|
|
|
- toastrLegacy.success(body, header, option);
|
|
|
- },
|
|
|
-
|
|
|
- toastWarning: (body: string, header = 'Warning', option = toastrLegacyOption.warning): void => {
|
|
|
- toastrLegacy.warning(body, header, option);
|
|
|
- },
|
|
|
-};
|