From db5ef05687f7b78c5ef9e37548c61f1edfb8a591 Mon Sep 17 00:00:00 2001 From: Christopher Date: Wed, 17 Feb 2021 18:36:48 +0100 Subject: [PATCH] tweak(resources/main): fetch contacts on initalize --- resources/client/cl_main.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/resources/client/cl_main.ts b/resources/client/cl_main.ts index 15d65e8..1457873 100644 --- a/resources/client/cl_main.ts +++ b/resources/client/cl_main.ts @@ -269,6 +269,7 @@ const togglePhoneVisible = async (): Promise => { * * * * * * * * * * * * */ async function Phone(): Promise { + fetchOnInitialize() if (config.PhoneAsItem) { // TODO: Do promise callback here // const hasPhoneItem = await emitNetPromise('phone:hasPhoneItem') @@ -314,7 +315,6 @@ onNet('phone:sendCredentials', (number: string) => { }); - // DO NOT CHANGE THIS EITHER, PLEASE - CHIP /* * * * * * * * * * * * * @@ -323,12 +323,10 @@ onNet('phone:sendCredentials', (number: string) => { * * * * * * * * * * * * * */ -// contacts app -RegisterNuiCallbackType(events.OPEN_APP_CONTACTS); -on(`__cfx_nui:${events.OPEN_APP_CONTACTS}`, (data: any, cb: Function) => { +function fetchOnInitialize() { emitNet(events.CONTACTS_GET_CONTACTS); - cb(); -}); +} + RegisterNuiCallbackType(events.OPEN_APP_LISTINGS); on(`__cfx_nui:${events.OPEN_APP_LISTINGS}`, (data: any, cb: Function) => { @@ -357,7 +355,6 @@ on(`__cfx_nui:${events.OPEN_APP_CAMERA}`, (data: any, cb: Function) => { RegisterNuiCallbackType(events.OPEN_APP_DAILER); on(`__cfx_nui:${events.OPEN_APP_DAILER}`, (data: any, cb: Function) => { - emitNet(events.CONTACTS_GET_CONTACTS); emitNet(events.PHONE_CALL_FETCH_CALLS); cb(); });