diff --git a/package/client/resource/interface/alert.ts b/package/client/resource/interface/alert.ts index 4da56c45..25ca8d25 100644 --- a/package/client/resource/interface/alert.ts +++ b/package/client/resource/interface/alert.ts @@ -11,7 +11,7 @@ interface AlertDialogProps { }; } -type alertDialog = (data: AlertDialogProps) => Promise<'cancel' | 'confirm'>; +type alertDialog = (data: AlertDialogProps) => Promise<'cancel' | 'confirm' | 'timeout' | undefined>; export const alertDialog: alertDialog = async (data, timeout?: number) => await exports.ox_lib.alertDialog(data, timeout); diff --git a/resource/interface/client/alert.lua b/resource/interface/client/alert.lua index f2feac93..c23c3187 100644 --- a/resource/interface/client/alert.lua +++ b/resource/interface/client/alert.lua @@ -21,7 +21,7 @@ local alertId = 0 ---@param data AlertDialogProps ---@param timeout? number Force the window to timeout after `x` milliseconds. ----@return 'cancel' | 'confirm' | nil +---@return 'cancel' | 'confirm' | 'timeout' | nil function lib.alertDialog(data, timeout) if alert then return end @@ -53,10 +53,10 @@ function lib.closeAlertDialog(reason) action = 'closeAlertDialog' }) - local p = alert + local _alert = alert alert = nil - if reason then p:reject(reason) else p:resolve() end + _alert:resolve(reason) end RegisterNUICallback('closeAlert', function(data, cb)