"use strict";
'use client';
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = useWarehouse;
const react_1 = require("react");
const __1 = require("../../../../..");
const query_1 = require("../query");
function useWarehouse({ warehouseId }) {
    const [warehouseData, setWarehouseData] = (0, react_1.useState)();
    const getData = async () => {
        var _a;
        try {
            const { data } = await (0, __1.PHXClientQueryV3)({
                query: query_1.getQrPrefixCodeQuery,
                variables: {
                    id: warehouseId,
                },
            });
            setWarehouseData((_a = data === null || data === void 0 ? void 0 : data.library_warehouse) === null || _a === void 0 ? void 0 : _a[0]);
        }
        catch (error) {
            console.log('error', error);
        }
    };
    (0, react_1.useEffect)(() => {
        if (warehouseId) {
            getData();
        }
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [warehouseId]);
    return {
        prefixQrCode: warehouseData === null || warehouseData === void 0 ? void 0 : warehouseData.qr_code_prefix,
        tem_name: warehouseData === null || warehouseData === void 0 ? void 0 : warehouseData.tem_name,
    };
}
//# sourceMappingURL=use-warehouse.js.map