fix type errors

This commit is contained in:
m5r 2021-09-25 07:12:16 +08:00
parent c9b657e44c
commit 9dea1ed499
3 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@ export default function useConversation(recipient: string) {
{}, {},
{ {
select(conversations) { select(conversations) {
if (!conversations[recipient]) { if (!conversations?.[recipient]) {
return null; return null;
} }

View File

@ -7,6 +7,10 @@ export default function useKnownRecipients() {
{}, {},
{ {
select(conversations) { select(conversations) {
if (!conversations) {
return [];
}
return Object.keys(conversations); return Object.keys(conversations);
}, },
}, },

View File

@ -83,7 +83,7 @@ const KeypadPage: BlitzPage = () => {
<button <button
onClick={async () => { onClick={async () => {
if (phoneNumber === "") { if (phoneNumber === "") {
const lastCall = phoneCalls[0]; const lastCall = phoneCalls?.[0];
if (lastCall) { if (lastCall) {
const lastCallRecipient = const lastCallRecipient =
lastCall.direction === Direction.Inbound ? lastCall.from : lastCall.to; lastCall.direction === Direction.Inbound ? lastCall.from : lastCall.to;