lenix 1.8.4 → 1.8.5
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/nui/fetch.ts +7 -4
- package/package.json +1 -1
package/nui/fetch.ts
CHANGED
|
@@ -30,8 +30,11 @@ export const fetchNuiServer = async <T extends NuiFetchGeneric>(
|
|
|
30
30
|
timeout?: number,
|
|
31
31
|
): Promise<T[0]> => {
|
|
32
32
|
const { data, error } = await fetchNui<Request<{
|
|
33
|
-
data: T[0]
|
|
34
|
-
error:
|
|
33
|
+
data: T[0]
|
|
34
|
+
error: null
|
|
35
|
+
} | {
|
|
36
|
+
data: null
|
|
37
|
+
error: string
|
|
35
38
|
}, '__nuiServer', {
|
|
36
39
|
id: T[1]
|
|
37
40
|
data: {
|
|
@@ -46,11 +49,11 @@ export const fetchNuiServer = async <T extends NuiFetchGeneric>(
|
|
|
46
49
|
requestData,
|
|
47
50
|
}
|
|
48
51
|
})
|
|
49
|
-
if (error) {
|
|
52
|
+
if (error !== null) {
|
|
50
53
|
const typeofError = typeof error
|
|
51
54
|
if (typeofError === 'string') throw error
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
throw `Expected 'error' typeof 'string', got ${error} typeof ${typeofError}`
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
return data
|