fix(ui): display error on flags update err
This commit is contained in:
parent
065c139494
commit
f75b6a5ed0
1 changed files with 2 additions and 4 deletions
|
|
@ -53,8 +53,6 @@ function NewFFlag({ siteId, fflagId }: { siteId: string; fflagId?: string }) {
|
|||
history.goBack()
|
||||
};
|
||||
|
||||
const onError = (e: string) => toast.error(`Failed to update flag: ${e}`)
|
||||
|
||||
const onSave = () => {
|
||||
const possibleError = featureFlagsStore.checkFlagForm();
|
||||
if (possibleError) return toast.error(possibleError);
|
||||
|
|
@ -63,8 +61,8 @@ function NewFFlag({ siteId, fflagId }: { siteId: string; fflagId?: string }) {
|
|||
toast.success('Feature flag updated.');
|
||||
history.push(withSiteId(fflagRead(fflagId), siteId));
|
||||
})
|
||||
.catch((e) => {
|
||||
e.json().then((body: Record<string, any>) => onError(body.errors.join(',')))
|
||||
.catch(() => {
|
||||
toast.error(`Failed to update flag, check your data and try again.`)
|
||||
})
|
||||
} else {
|
||||
featureFlagsStore.createFlag().then(() => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue