IO-1551 Refactor messaging.
This commit is contained in:
@@ -91,13 +91,11 @@ export default function CiecaSelect(parts = true, labor = true) {
|
||||
}
|
||||
|
||||
export function GetPartTypeName(part_type) {
|
||||
console.log(part_type);
|
||||
if (!part_type) return null;
|
||||
return i18n.t(`joblines.fields.part_types.${part_type.toUpperCase()}`);
|
||||
}
|
||||
|
||||
export function Get(part_type) {
|
||||
console.log(part_type);
|
||||
if (!part_type) return null;
|
||||
return i18n.t(`joblines.fields.part_types.${part_type.toUpperCase()}`);
|
||||
}
|
||||
|
||||
@@ -50,13 +50,18 @@ const roundTripLink = new ApolloLink((operation, forward) => {
|
||||
const TrackExecutionTime = async (operationName, time) => {
|
||||
const rdxStore = store.getState();
|
||||
try {
|
||||
console.log("trying");
|
||||
axios.post("/ioevent", {
|
||||
operationName,
|
||||
time,
|
||||
dbevent: true,
|
||||
user: rdxStore.user.currentUser.email,
|
||||
imexshopid: rdxStore.user.bodyshop.imexshopid,
|
||||
user:
|
||||
rdxStore.user &&
|
||||
rdxStore.user.currentUser &&
|
||||
rdxStore.user.currentUser.email,
|
||||
imexshopid:
|
||||
rdxStore.user &&
|
||||
rdxStore.user.bodyshop &&
|
||||
rdxStore.user.bodyshop.imexshopid,
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("IOEvent Error", error);
|
||||
|
||||
@@ -148,8 +148,6 @@ export async function RenderTemplates(
|
||||
},
|
||||
};
|
||||
|
||||
console.log("reportRequest", reportRequest);
|
||||
|
||||
try {
|
||||
const render = await jsreport.renderAsync(reportRequest);
|
||||
if (!renderAsHtml) {
|
||||
|
||||
34
client/src/utils/fcm-handler.js
Normal file
34
client/src/utils/fcm-handler.js
Normal file
@@ -0,0 +1,34 @@
|
||||
export default async function FcmHandler({ client, payload }) {
|
||||
console.log("Handling payload type", payload);
|
||||
switch (payload.type) {
|
||||
case "messaging-inbound":
|
||||
client.cache.modify({
|
||||
id: client.cache.identify({
|
||||
__typename: "conversations",
|
||||
id: payload.conversationid,
|
||||
}),
|
||||
fields: {
|
||||
messages_aggregate(cached) {
|
||||
return { aggregate: { count: cached.aggregate.count + 1 } };
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "messaging-mark-conversation-read":
|
||||
client.cache.modify({
|
||||
id: client.cache.identify({
|
||||
__typename: "conversations",
|
||||
id: payload.conversationid,
|
||||
}),
|
||||
fields: {
|
||||
messages_aggregate(cached) {
|
||||
return { aggregate: { count: 0 } };
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
default:
|
||||
console.log("No payload type set.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user