@heritageai/messaging 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,9 +12,11 @@ const pushNotificationToWS = async (payload) => {
|
|
|
12
12
|
const WS_GATEWAY_URL = process.env.WS_GATEWAY_URL;
|
|
13
13
|
if (!WS_GATEWAY_URL)
|
|
14
14
|
throw new Error("WS_GATEWAY_URL not defined");
|
|
15
|
-
await
|
|
16
|
-
|
|
17
|
-
});
|
|
15
|
+
// await axios.post(`${WS_GATEWAY_URL}/internal/notify`, payload, {
|
|
16
|
+
// headers: { "Content-Type": "application/json" },
|
|
17
|
+
// });
|
|
18
|
+
const { userId, notification } = payload;
|
|
19
|
+
await axios_1.default.post(`${process.env.WS_GATEWAY_URL}/internal/notify`, { userId, notification }, { headers: { "x-internal-key": process.env.INTERNAL_API_KEY } });
|
|
18
20
|
}
|
|
19
21
|
catch (err) {
|
|
20
22
|
logger_1.logger.error("Failed to push notification to WS-Gateway", err);
|
package/package.json
CHANGED
|
@@ -17,9 +17,16 @@ export const pushNotificationToWS = async (payload: WSNotificationPayload) => {
|
|
|
17
17
|
const WS_GATEWAY_URL = process.env.WS_GATEWAY_URL;
|
|
18
18
|
if (!WS_GATEWAY_URL) throw new Error("WS_GATEWAY_URL not defined");
|
|
19
19
|
|
|
20
|
-
await axios.post(`${WS_GATEWAY_URL}/notify`, payload, {
|
|
21
|
-
|
|
22
|
-
});
|
|
20
|
+
// await axios.post(`${WS_GATEWAY_URL}/internal/notify`, payload, {
|
|
21
|
+
// headers: { "Content-Type": "application/json" },
|
|
22
|
+
// });
|
|
23
|
+
|
|
24
|
+
const { userId, notification } = payload;
|
|
25
|
+
await axios.post(
|
|
26
|
+
`${process.env.WS_GATEWAY_URL}/internal/notify`,
|
|
27
|
+
{ userId, notification },
|
|
28
|
+
{ headers: { "x-internal-key": process.env.INTERNAL_API_KEY! } },
|
|
29
|
+
);
|
|
23
30
|
} catch (err) {
|
|
24
31
|
logger.error("Failed to push notification to WS-Gateway", err);
|
|
25
32
|
throw err;
|