lenix 1.7.19 → 1.7.20

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.
package/client/nui.ts CHANGED
@@ -23,10 +23,14 @@ export const onNui = <T extends Request<unknown, string, object>>(
23
23
  id: T[1],
24
24
  cb: (data: T[2]) => T[0] | Promise<T[0]>
25
25
  ): void => {
26
- RegisterNuiCallback(id, (
26
+ RegisterNuiCallback(id, async (
27
27
  data: T[2],
28
28
  reply: (_: unknown) => void
29
29
  ) => {
30
- reply(cb(data))
30
+ try {
31
+ reply(await cb(data))
32
+ } catch(e) {
33
+ throw e
34
+ }
31
35
  })
32
36
  }
package/nui/trigger.ts CHANGED
@@ -15,7 +15,7 @@ export const triggerNui = async <T extends Request<unknown, string, object>>(
15
15
  headers: {
16
16
  'Content-Type': 'application/json; charset=UTF-8'
17
17
  },
18
- body: JSON.stringify(data ?? {})
18
+ body: JSON.stringify(data)
19
19
  })
20
20
  return await response.json()
21
21
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lenix",
3
- "version": "1.7.19",
3
+ "version": "1.7.20",
4
4
  "description": "Typed FiveM utilities for client, server, shared, and NUI scripts",
5
5
  "author": "Lenix",
6
6
  "license": "MIT",