diff options
author | Sebastian <sebasjm@gmail.com> | 2023-02-10 09:50:54 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-02-10 09:52:01 -0300 |
commit | 53af8b486fd8a538c1f54a2ce66ed5f74b2b46ed (patch) | |
tree | fdda21230b6f98a8cf84f6459910c76c610234dd /packages/merchant-backoffice-ui/src/hooks/reserves.ts | |
parent | 7a591c39d78c5183ae05d36221d0bcf8322cea92 (diff) | |
download | wallet-core-53af8b486fd8a538c1f54a2ce66ed5f74b2b46ed.tar.xz |
fix: request error is whats being thrown
Diffstat (limited to 'packages/merchant-backoffice-ui/src/hooks/reserves.ts')
-rw-r--r-- | packages/merchant-backoffice-ui/src/hooks/reserves.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/packages/merchant-backoffice-ui/src/hooks/reserves.ts b/packages/merchant-backoffice-ui/src/hooks/reserves.ts index 0215f32c5..a4c0a7e55 100644 --- a/packages/merchant-backoffice-ui/src/hooks/reserves.ts +++ b/packages/merchant-backoffice-ui/src/hooks/reserves.ts @@ -13,13 +13,13 @@ You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import useSWR, { useSWRConfig } from "swr"; -import { MerchantBackend } from "../declaration.js"; import { - HttpError, HttpResponse, HttpResponseOk, + RequestError, } from "@gnu-taler/web-util/lib/index.browser"; +import useSWR, { useSWRConfig } from "swr"; +import { MerchantBackend } from "../declaration.js"; import { useBackendInstanceRequest, useMatchMutate } from "./backend.js"; export function useReservesAPI(): ReserveMutateAPI { @@ -121,12 +121,12 @@ export function useInstanceReserves(): HttpResponse< const { data, error, isValidating } = useSWR< HttpResponseOk<MerchantBackend.Tips.TippingReserveStatus>, - HttpError<MerchantBackend.ErrorDetail> + RequestError<MerchantBackend.ErrorDetail> >([`/private/reserves`], fetcher); if (isValidating) return { loading: true, data: data?.data }; if (data) return data; - if (error) return error; + if (error) return error.info; return { loading: true }; } @@ -140,7 +140,7 @@ export function useReserveDetails( const { data, error, isValidating } = useSWR< HttpResponseOk<MerchantBackend.Tips.ReserveDetail>, - HttpError<MerchantBackend.ErrorDetail> + RequestError<MerchantBackend.ErrorDetail> >([`/private/reserves/${reserveId}`], reserveDetailFetcher, { refreshInterval: 0, refreshWhenHidden: false, @@ -151,7 +151,7 @@ export function useReserveDetails( if (isValidating) return { loading: true, data: data?.data }; if (data) return data; - if (error) return error; + if (error) return error.info; return { loading: true }; } @@ -162,7 +162,7 @@ export function useTipDetails( const { data, error, isValidating } = useSWR< HttpResponseOk<MerchantBackend.Tips.TipDetails>, - HttpError<MerchantBackend.ErrorDetail> + RequestError<MerchantBackend.ErrorDetail> >([`/private/tips/${tipId}`], tipsDetailFetcher, { refreshInterval: 0, refreshWhenHidden: false, @@ -173,6 +173,6 @@ export function useTipDetails( if (isValidating) return { loading: true, data: data?.data }; if (data) return data; - if (error) return error; + if (error) return error.info; return { loading: true }; } |