fix: Separate toasts storage to own MobX store (#2339)

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Saumya Pandey
2021-07-20 14:36:10 +05:30
committed by GitHub
parent f64ab37d3c
commit fdb85ec195
45 changed files with 297 additions and 231 deletions

View File

@@ -6,7 +6,7 @@ import * as React from "react";
import { withTranslation, type TFunction } from "react-i18next";
import AuthStore from "stores/AuthStore";
import MembershipsStore from "stores/MembershipsStore";
import UiStore from "stores/UiStore";
import ToastsStore from "stores/ToastsStore";
import UsersStore from "stores/UsersStore";
import Collection from "models/Collection";
import User from "models/User";
@@ -21,7 +21,7 @@ import PaginatedList from "components/PaginatedList";
import MemberListItem from "./components/MemberListItem";
type Props = {
ui: UiStore,
toasts: ToastsStore,
auth: AuthStore,
collection: Collection,
memberships: MembershipsStore,
@@ -62,14 +62,14 @@ class AddPeopleToCollection extends React.Component<Props> {
userId: user.id,
permission: "read_write",
});
this.props.ui.showToast(
this.props.toasts.showToast(
t("{{ userName }} was added to the collection", {
userName: user.name,
}),
{ type: "success" }
);
} catch (err) {
this.props.ui.showToast(t("Could not add user"), { type: "error" });
this.props.toasts.showToast(t("Could not add user"), { type: "error" });
}
};
@@ -130,5 +130,5 @@ class AddPeopleToCollection extends React.Component<Props> {
}
export default withTranslation()<AddPeopleToCollection>(
inject("auth", "users", "memberships", "ui")(AddPeopleToCollection)
inject("auth", "users", "memberships", "toasts")(AddPeopleToCollection)
);