entity-server-client 0.3.1 → 0.3.2
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/package.json +1 -1
- package/src/client/base.ts +1 -1
- package/src/client/request.ts +2 -2
package/package.json
CHANGED
package/src/client/base.ts
CHANGED
|
@@ -306,7 +306,7 @@ export class EntityServerClientBase {
|
|
|
306
306
|
credentials: "include",
|
|
307
307
|
});
|
|
308
308
|
|
|
309
|
-
const data = await res.json();
|
|
309
|
+
const data = (await res.json()) as { ok?: boolean; message?: string };
|
|
310
310
|
if (!data.ok) {
|
|
311
311
|
const err = new Error(
|
|
312
312
|
data.message ?? `EntityServer error (HTTP ${res.status})`,
|
package/src/client/request.ts
CHANGED
|
@@ -106,7 +106,7 @@ export async function entityRequest<T>(
|
|
|
106
106
|
const res = await fetch(baseUrl + path, {
|
|
107
107
|
method,
|
|
108
108
|
headers,
|
|
109
|
-
...(fetchBody != null ? { body: fetchBody as
|
|
109
|
+
...(fetchBody != null ? { body: fetchBody as RequestInit["body"] } : {}),
|
|
110
110
|
credentials: "include",
|
|
111
111
|
});
|
|
112
112
|
|
|
@@ -126,7 +126,7 @@ export async function entityRequest<T>(
|
|
|
126
126
|
return (await res.text()) as T;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
const data = await res.json();
|
|
129
|
+
const data = (await res.json()) as { ok?: boolean; message?: string };
|
|
130
130
|
if (requireOkShape && !data.ok) {
|
|
131
131
|
const err = new Error(
|
|
132
132
|
data.message ?? `EntityServer error (HTTP ${res.status})`,
|