aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/hooks/reserves.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/hooks/reserves.ts')
-rw-r--r--packages/merchant-backoffice-ui/src/hooks/reserves.ts18
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 };
}