shelflife-react-hooks 1.0.10 → 1.0.12
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/dist/index.cjs.js +7 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +7 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/context/AuthContext.tsx +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -93,7 +93,6 @@ var signupRequest = async (config, dto) => runWithRequestState(config, async ()
|
|
|
93
93
|
if (!payload) {
|
|
94
94
|
throw new Error("Signup response missing user");
|
|
95
95
|
}
|
|
96
|
-
config.setUser(payload);
|
|
97
96
|
return payload;
|
|
98
97
|
});
|
|
99
98
|
var changePasswordRequest = async (config, dto) => runWithRequestState(config, async () => {
|
|
@@ -268,7 +267,7 @@ var AuthProvider = ({
|
|
|
268
267
|
}) => {
|
|
269
268
|
const [token, setTokenState] = useState(initialToken);
|
|
270
269
|
const [user, setUser] = useState(null);
|
|
271
|
-
const [isLoading, setIsLoading] = useState(
|
|
270
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
272
271
|
const [isError, setIsError] = useState(false);
|
|
273
272
|
const [error, setError] = useState(null);
|
|
274
273
|
useEffect(() => {
|
|
@@ -1465,6 +1464,9 @@ var createShoppingItemRequest = async (config, storageId, dto) => runWithRequest
|
|
|
1465
1464
|
body: JSON.stringify(dto)
|
|
1466
1465
|
});
|
|
1467
1466
|
if (!response.ok) {
|
|
1467
|
+
const err = await readJson(response);
|
|
1468
|
+
if (err?.productId || err?.amountToBuy)
|
|
1469
|
+
throw err;
|
|
1468
1470
|
throw new Error("Failed to create shopping list item");
|
|
1469
1471
|
}
|
|
1470
1472
|
const payload = await readJson(response);
|
|
@@ -1483,6 +1485,9 @@ var editShoppingItemRequest = async (config, storageId, itemId, dto) => runWithR
|
|
|
1483
1485
|
body: JSON.stringify(dto)
|
|
1484
1486
|
});
|
|
1485
1487
|
if (!response.ok) {
|
|
1488
|
+
const err = await readJson(response);
|
|
1489
|
+
if (err?.productId || err?.amountToBuy)
|
|
1490
|
+
throw err;
|
|
1486
1491
|
throw new Error("Failed to edit shopping list item");
|
|
1487
1492
|
}
|
|
1488
1493
|
const payload = await readJson(response);
|