IO-244 Resolve IOU

This commit is contained in:
Patrick Fic
2021-12-15 14:34:24 -08:00
parent 1b8a76d5e0
commit e46d5b833b
9 changed files with 71 additions and 4 deletions

View File

@@ -7,8 +7,25 @@ import {
} from "../../graphql/associations.queries";
import AlertComponent from "../alert/alert.component";
import ProfileShopsComponent from "./profile-shops.component";
import axios from "axios";
import { messaging } from "../../firebase/firebase.utils";
import { getToken } from "firebase/messaging";
export default function ProfileShopsContainer() {
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(ProfileShopsContainer);
export function ProfileShopsContainer({ bodyshop }) {
const { loading, error, data } = useQuery(QUERY_ALL_ASSOCIATIONS, {
fetchPolicy: "network-only",
nextFetchPolicy: "network-only",
@@ -18,6 +35,11 @@ export default function ProfileShopsContainer() {
const updateActiveShop = async (activeShopId) => {
logImEXEvent("profile_change_active_shop");
await axios.post("/notifications/unsubscribe", {
fcm_tokens: await getToken(messaging),
imexshopid: bodyshop.imexshopid,
type: "messaging",
});
await Promise.all(
data.associations.map(async (record) => {
await updateAssocation({