Resolve unsub issue.
This commit is contained in:
@@ -35,11 +35,17 @@ export function ProfileShopsContainer({ bodyshop }) {
|
|||||||
const updateActiveShop = async (activeShopId) => {
|
const updateActiveShop = async (activeShopId) => {
|
||||||
logImEXEvent("profile_change_active_shop");
|
logImEXEvent("profile_change_active_shop");
|
||||||
|
|
||||||
await axios.post("/notifications/unsubscribe", {
|
try {
|
||||||
fcm_tokens: await getToken(messaging),
|
const fcm_tokens = await getToken(messaging);
|
||||||
imexshopid: bodyshop.imexshopid,
|
|
||||||
type: "messaging",
|
await axios.post("/notifications/unsubscribe", {
|
||||||
});
|
fcm_tokens,
|
||||||
|
imexshopid: bodyshop.imexshopid,
|
||||||
|
type: "messaging",
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log("No FCM token. Skipping unsubscribe.");
|
||||||
|
}
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
data.associations.map(async (record) => {
|
data.associations.map(async (record) => {
|
||||||
await updateAssocation({
|
await updateAssocation({
|
||||||
|
|||||||
@@ -101,13 +101,19 @@ export function* signOutStart() {
|
|||||||
logImEXEvent("redux_sign_out");
|
logImEXEvent("redux_sign_out");
|
||||||
|
|
||||||
const state = yield select();
|
const state = yield select();
|
||||||
console.log(yield getToken(messaging));
|
|
||||||
//unsub from topic.
|
//unsub from topic.
|
||||||
yield call(axios.post, "/notifications/unsubscribe", {
|
|
||||||
fcm_tokens: yield getToken(messaging),
|
try {
|
||||||
imexshopid: state.user.bodyshop.imexshopid,
|
const fcm_tokens = yield getToken(messaging);
|
||||||
type: "messaging",
|
yield call(axios.post, "/notifications/unsubscribe", {
|
||||||
});
|
fcm_tokens,
|
||||||
|
imexshopid: state.user.bodyshop.imexshopid,
|
||||||
|
type: "messaging",
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log("No FCM token. Skipping unsubscribe.");
|
||||||
|
}
|
||||||
|
|
||||||
yield signOut(auth);
|
yield signOut(auth);
|
||||||
yield put(signOutSuccess());
|
yield put(signOutSuccess());
|
||||||
|
|||||||
Reference in New Issue
Block a user