From fd29f986e4d20e923907c394303ee7396b5613f3 Mon Sep 17 00:00:00 2001 From: EgleH Date: Mon, 23 Jan 2023 13:40:23 +0100 Subject: [PATCH] Date fix for alerts and recent calls (#176) * date fix for alerts and recent calls * add a check for value to exist * getRecentCalls with sip_callid Co-authored-by: EgleHelms --- src/api/index.ts | 12 ++++++------ src/components/forms/local-limits.tsx | 2 +- src/containers/internal/views/alerts/index.tsx | 4 +--- .../internal/views/recent-calls/details.tsx | 10 ++++++---- src/containers/internal/views/recent-calls/pcap.tsx | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 3ef4718..96e4fee 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -530,19 +530,19 @@ export const getRecentCalls = (sid: string, query: Partial) => { ); }; -export const getRecentCall = (sid: string, callSid: string) => { +export const getRecentCall = (sid: string, sipCallId: string) => { return getFetch( import.meta.env.DEV - ? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${callSid}` - : `${API_ACCOUNTS}/${sid}/RecentCalls/${callSid}` + ? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${sipCallId}` + : `${API_ACCOUNTS}/${sid}/RecentCalls/${sipCallId}` ); }; -export const getPcap = (sid: string, callSid: string) => { +export const getPcap = (sid: string, sipCallId: string) => { return getBlob( import.meta.env.DEV - ? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${callSid}/pcap` - : `${API_ACCOUNTS}/${sid}/RecentCalls/${callSid}/pcap` + ? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${sipCallId}/pcap` + : `${API_ACCOUNTS}/${sid}/RecentCalls/${sipCallId}/pcap` ); }; diff --git a/src/components/forms/local-limits.tsx b/src/components/forms/local-limits.tsx index 7fa8b9f..ea40974 100644 --- a/src/components/forms/local-limits.tsx +++ b/src/components/forms/local-limits.tsx @@ -110,7 +110,7 @@ export const LocalLimits = ({ Scope.account } > - + { diff --git a/src/containers/internal/views/alerts/index.tsx b/src/containers/internal/views/alerts/index.tsx index 17a4e85..910ddb5 100644 --- a/src/containers/internal/views/alerts/index.tsx +++ b/src/containers/internal/views/alerts/index.tsx @@ -101,9 +101,7 @@ export const Alerts = () => {
- {dayjs - .unix(alert.time / 1000) - .format("YYYY MM.DD hh:mm a")} + {dayjs(alert.time).format("YYYY MM.DD hh:mm a")}
diff --git a/src/containers/internal/views/recent-calls/details.tsx b/src/containers/internal/views/recent-calls/details.tsx index f4381f2..2c802ea 100644 --- a/src/containers/internal/views/recent-calls/details.tsx +++ b/src/containers/internal/views/recent-calls/details.tsx @@ -28,9 +28,7 @@ export const DetailsItem = ({ call }: DetailsItemProps) => {
- {dayjs - .unix(call.attempted_at / 1000) - .format("YYYY MM.DD hh:mm a")} + {dayjs(call.attempted_at).format("YYYY MM.DD hh:mm a")} {call.direction === "inbound" ? ( @@ -62,7 +60,11 @@ export const DetailsItem = ({ call }: DetailsItemProps) => { {Object.keys(call).map((key) => (
{key}:
-
{call[key as keyof typeof call].toString()}
+
+ {call[key as keyof typeof call] + ? call[key as keyof typeof call].toString() + : "null"} +
))}
diff --git a/src/containers/internal/views/recent-calls/pcap.tsx b/src/containers/internal/views/recent-calls/pcap.tsx index 1cce9fa..e4b8318 100644 --- a/src/containers/internal/views/recent-calls/pcap.tsx +++ b/src/containers/internal/views/recent-calls/pcap.tsx @@ -13,10 +13,10 @@ export const PcapButton = ({ call }: PcapButtonProps) => { const [pcap, setPcap] = useState(); useEffect(() => { - getRecentCall(call.account_sid, call.call_sid) + getRecentCall(call.account_sid, call.sip_callid) .then(({ json }) => { if (json.total > 0) { - getPcap(call.account_sid, call.call_sid) + getPcap(call.account_sid, call.sip_callid) .then(({ blob }) => { if (blob) { setPcap({