adding little description about the data sync and adding a sync button
This commit is contained in:
parent
714a221154
commit
050225bdb1
3 changed files with 46 additions and 21 deletions
|
|
@ -4,6 +4,7 @@ import { pond } from "protobuf-ts/pond";
|
|||
import React, { createContext, PropsWithChildren, useContext } from "react";
|
||||
//import { or } from "utils";
|
||||
import { pondURL } from "./pond";
|
||||
import { useGlobalState } from "providers/StateContainer";
|
||||
|
||||
export interface ILibraCartProxyAPIContext {
|
||||
//add new organization
|
||||
|
|
@ -33,6 +34,7 @@ export interface ILibraCartProxyAPIContext {
|
|||
libracartKey?: string,
|
||||
as?: string
|
||||
) => Promise<AxiosResponse<pond.ListLibraCartDestinationsResponse>>;
|
||||
syncData: () => Promise<any>
|
||||
}
|
||||
|
||||
export const LibraCartProxyAPIContext = createContext<ILibraCartProxyAPIContext>(
|
||||
|
|
@ -43,6 +45,7 @@ interface Props {}
|
|||
|
||||
export default function LibraCartProvider(props: PropsWithChildren<Props>) {
|
||||
const { children } = props;
|
||||
const [{as}] = useGlobalState();
|
||||
const { post, get, put } = useHTTP();
|
||||
|
||||
const addAccount = (
|
||||
|
|
@ -104,13 +107,18 @@ export default function LibraCartProvider(props: PropsWithChildren<Props>) {
|
|||
)
|
||||
}
|
||||
|
||||
const syncData = () => {
|
||||
return get(pondURL("/libracartImport" + (as ? "?as=" + as : "")))
|
||||
}
|
||||
|
||||
return (
|
||||
<LibraCartProxyAPIContext.Provider
|
||||
value={{
|
||||
addAccount,
|
||||
listAccounts,
|
||||
updateAccount,
|
||||
listDestinations
|
||||
listDestinations,
|
||||
syncData
|
||||
}}>
|
||||
{children}
|
||||
</LibraCartProxyAPIContext.Provider>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue