making sure the bin uses the correct data when using libracart as an inventory control

This commit is contained in:
csawatzky 2025-08-12 16:20:04 -06:00
parent e5300b19f4
commit 3e6185be8f
8 changed files with 115 additions and 69 deletions

View file

@ -27,15 +27,12 @@ export interface ILibraCartProxyAPIContext {
options: pond.DataOption[],
as?: string
) => Promise<AxiosResponse<pond.UpdateLibraCartAccountResponse>>;
listFields: (
listDestinations: (
limit: number,
offset: number,
// order?: "asc" | "desc",
// orderBy?: string,
// search?: string,
as?: string,
asRoot?: boolean
) => Promise<AxiosResponse<pond.ListLibraCartFieldsResponse>>;
libracartKey?: string,
as?: string
) => Promise<AxiosResponse<pond.ListLibraCartDestinationsResponse>>;
}
export const LibraCartProxyAPIContext = createContext<ILibraCartProxyAPIContext>(
@ -91,28 +88,6 @@ export default function LibraCartProvider(props: PropsWithChildren<Props>) {
);
};
const listFields = (
limit: number,
offset: number,
// order?: "asc" | "desc",
// orderBy?: string,
// search?: string,
as?: string,
asRoot?: boolean
) => {
return get<pond.ListFieldsResponse>(
pondURL(
"/libracartFields" +
"?limit=" +
limit +
"&offset=" +
offset +
(as ? "&as=" + as : "") +
(asRoot ? "&asRoot=" + asRoot.toString() : "")
)
);
};
const updateAccount = (key: string, options: pond.DataOption[], as?: string) => {
return put<pond.UpdateLibraCartAccountResponse>(
pondURL(
@ -121,13 +96,21 @@ export default function LibraCartProvider(props: PropsWithChildren<Props>) {
);
};
const listDestinations = (limit: number, offset: number, libracartKey?: string, as?: string) => {
return get<pond.ListLibraCartDestinationsResponse>(
pondURL(
"/libracartDestinations?limit" + limit + "&offset=" + offset + (libracartKey ? "&libracartKey=" + libracartKey : "") + (as ? "&as=" + as : "")
)
)
}
return (
<LibraCartProxyAPIContext.Provider
value={{
addAccount,
listAccounts,
updateAccount,
listFields
listDestinations
}}>
{children}
</LibraCartProxyAPIContext.Provider>