import {http} from "../utils/http"; import useSWR from "swr"; const url = { findAllLockeyInLocations: (qrCode) => `/bots/find-all/Lockey/${qrCode}`, findLocationByQrCode: (qrCode) => `/locations/findOne/${qrCode}`, createOrder: () => `/bots/create-order`, checkTransaction: (orderId) => `/bots/find/one-history/${orderId}`, } const hooks = { useGetAllLockey(qrCode) { return useSWR(url.findAllLockeyInLocations(qrCode), http.fetcher); }, useGetLocationByQR(qrCode) { return useSWR(url.findLocationByQrCode(qrCode), http.fetcher); } } const api = { async useCheckTransactionByOrderId(orderId) { const res = await http.fetcher(url.checkTransaction(orderId)); return res }, } export const botsRepository = { url, hooks, api }