chore: Automatically display errors as toast if uncaught in actions (#6482)

Reduces plumbing
This commit is contained in:
Tom Moor
2024-02-05 16:40:29 -08:00
committed by GitHub
parent 3a125beb9e
commit d6595c15ad
5 changed files with 44 additions and 61 deletions

View File

@@ -86,19 +86,14 @@ export const clearIndexedDB = createAction({
});
export const createTestUsers = createAction({
name: "Create test users",
name: "Create 10 test users",
icon: <UserIcon />,
section: DeveloperSection,
visible: () => env.ENVIRONMENT === "development",
perform: async () => {
const count = 10;
try {
await client.post("/developer.create_test_users", { count });
toast.message(`${count} test users created`);
} catch (err) {
toast.error(err.message);
}
await client.post("/developer.create_test_users", { count });
toast.message(`${count} test users created`);
},
});