summaryrefslogtreecommitdiffstats
path: root/ui/src/components/community-form.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-01-22 22:29:11 -0500
committerDessalines <tyhou13@gmx.com>2020-01-22 22:29:11 -0500
commit3b4258096c3c3dc160090436c9205e1ecf2e8e75 (patch)
treef07264d3de3b169c6140b2bf303ff7732d908b0a /ui/src/components/community-form.tsx
parent66af9623d90aadd47c9cf37faeac4f60f1d818d4 (diff)
Adding a toaster to replace alerts. Fixes #457
Diffstat (limited to 'ui/src/components/community-form.tsx')
-rw-r--r--ui/src/components/community-form.tsx15
1 files changed, 4 insertions, 11 deletions
diff --git a/ui/src/components/community-form.tsx b/ui/src/components/community-form.tsx
index 2085da28..ec58b010 100644
--- a/ui/src/components/community-form.tsx
+++ b/ui/src/components/community-form.tsx
@@ -10,8 +10,8 @@ import {
GetSiteResponse,
} from '../interfaces';
import { WebSocketService } from '../services';
-import { msgOp, capitalizeFirstLetter } from '../utils';
-import * as autosize from 'autosize';
+import { msgOp, capitalizeFirstLetter, toast } from '../utils';
+import autosize from 'autosize';
import { i18n } from '../i18next';
import { T } from 'inferno-i18next';
@@ -67,14 +67,7 @@ export class CommunityForm extends Component<
}
this.subscription = WebSocketService.Instance.subject
- .pipe(
- retryWhen(errors =>
- errors.pipe(
- delay(3000),
- take(10)
- )
- )
- )
+ .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
.subscribe(
msg => this.parseMessage(msg),
err => console.error(err),
@@ -250,7 +243,7 @@ export class CommunityForm extends Component<
let op: UserOperation = msgOp(msg);
console.log(msg);
if (msg.error) {
- alert(i18n.t(msg.error));
+ toast(i18n.t(msg.error), 'danger');
this.state.loading = false;
this.setState(this.state);
return;