This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Front | Fix] Infinite ErrorToast due to NewUser (#94)
* The most significant changes include the modification of the `AdminHub.cs` file to remove the `System` namespace import and the update of the `Delete.cs` file to include additional properties in the `product` object. The `NewUser.tsx` file has been simplified and the `Get.tsx` file has been updated to import new functions and update the `UserGet` class. 1. The `AdminHub.cs` file has been modified to remove the `System` namespace import. This change simplifies the code and removes unnecessary dependencies. 2. The `Delete.cs` file has been updated to include the `Variants`, `Types`, and `Combos` in the `product` object. The `IsArchived` property of the `product` object is set to `true` and the `deleteVariant` function is called for each variant in the `product` object. This change enhances the functionality of the `product` object and allows for more efficient deletion of variants. 3. In the `NewUser.tsx` file, the `useMount` function has been simplified to a single line. The `OnNewUserSubject.subscribe` function is called when the component is mounted and the `toggle` function is called if the subscription returns `true`. This change simplifies the code and improves the efficiency of the `NewUser` component. 4. The `Get.tsx` file has been updated to import the `useBoolean`, `useMount` functions from `ahooks` and the `OnNewUserSubject` from `~/Components/NewUser`. The `UserGet` class has been updated to version `0.4.1`. A new boolean state `onNew` has been added and the `OnNewUserSubject.subscribe` function is called when the component is mounted to set the `onNew` state. The error handling in the `useLiveQuery` function has been updated to log the error if `onNew` is `true` or the error is an instance of `NotLoginError`. This change improves error handling and updates the `UserGet` class to the latest version. * The most significant changes involve the introduction of a new error class `EmptyResponseError` and the modification of error handling in `SignalR.ts` and `Get.tsx`. The `EmptyResponseError` class is used to handle cases where the server returns an empty response. In `SignalR.ts`, this new error class replaces the previously used `TypeError`. In `Get.tsx`, the error handling has been restructured with a `try-catch` block that handles different types of errors differently. The version number in the `UserGet` class in `Get.tsx` was also updated. Changes: 1. A new error class `EmptyResponseError` was added to `Exceptions.ts`. This class is used to throw an error when the server returns an empty response. 2. The `EmptyResponseError` class was imported into `SignalR.ts` and `Get.tsx` files. 3. In `SignalR.ts`, the `TypeError` that was previously thrown when the server returned an empty response was replaced with the new `EmptyResponseError`. 4. In `Get.tsx`, the `useBoolean` and `useMount` hooks were removed, and the `OnNewUserSubject` subscription was also removed. Instead, a `try-catch` block was added to handle errors when getting user information. 5. The version number in the `UserGet` class in `Get.tsx` was updated from `0.4.1` to `0.4.2`.
- Loading branch information