diff --git a/Form/withForm.tsx b/Form/withForm.tsx index 38f10cb..f24d043 100644 --- a/Form/withForm.tsx +++ b/Form/withForm.tsx @@ -1,8 +1,8 @@ import { FormikForm } from "@shared/nej-react-utils/Form/FormikForm"; -import { useApiClient, useProject } from "@utils/NejManager/NejProvider"; +import { useApiClient } from "@utils/NejManager/NejProvider"; import useMethod from "../macros/useMethod.macro"; import useQuery from "../macros/useQuery.macro"; -import { CancelablePromise, PortalApiClient, ProjectResponse } from "@services/portal-api"; +import { CancelablePromise, ApiClient, OwnerResponse, useOwner } from "@services/api"; type FormProps = { refresh: () => void; @@ -10,10 +10,10 @@ type FormProps = { initialData?: T; }; export type WithFormProps = P & FormProps; -export function withForm>(WrappedForm: React.ComponentType, method: (client: PortalApiClient, project: ProjectResponse, props: P) => (body: T) => CancelablePromise, submitText: string) { +export function withForm>(WrappedForm: React.ComponentType, method: (client: ApiClient, project: OwnerResponse, props: P) => (body: T) => CancelablePromise, submitText: string) { return function GameFormWrapper({ refresh, afterSubmit, initialData, ...props }: P) { const client = useApiClient(); - const company = useProject(); + const company = useOwner(); const fnc = method(client, company, { ...props, initialData } as P); console.log(fnc); diff --git a/macros/useMethod.macro.cjs b/macros/useMethod.macro.cjs index 8248a55..3060991 100644 --- a/macros/useMethod.macro.cjs +++ b/macros/useMethod.macro.cjs @@ -78,7 +78,7 @@ function useMethod({ references, state, babel }) { let useStateHookImport = addNamed(declPath, "useState", "react"); let useCallbackHookImport = addNamed(declPath, "useCallback", "react"); - let servicePath = "@services/portal-api"; + let servicePath = "@services/api"; let apiErrorImport = addNamed(declPath, "ApiError", servicePath); let nejServicesPath = "@utils/NejManager/NejProvider"; diff --git a/macros/useMethod.macro.d.ts b/macros/useMethod.macro.d.ts index a8d5664..eb15a0b 100644 --- a/macros/useMethod.macro.d.ts +++ b/macros/useMethod.macro.d.ts @@ -1,4 +1,4 @@ -import { CancelablePromise, Error } from "src/services/portal-api"; +import { CancelablePromise, Error } from "src/services/api"; export default function useMethod(method: (...args: Arg) => CancelablePromise, onDone?: (data: T) => void, diff --git a/macros/useQuery.macro.cjs b/macros/useQuery.macro.cjs index 1bdf804..de0c4b0 100644 --- a/macros/useQuery.macro.cjs +++ b/macros/useQuery.macro.cjs @@ -87,7 +87,7 @@ function useQuery({ references, state, babel }) { } let fullCallPathString = reduceCallee(call.callee) - let servicePath = "@services/portal-api"; + let servicePath = "@services/api"; let apiErrorImport = addNamed(declPath, "ApiError", servicePath); let useStateSrc = babel.template("[DATA, CALL_SET] = USE_STATE({data: null, error: null, loading: true})")({ diff --git a/macros/useQuery.macro.d.ts b/macros/useQuery.macro.d.ts index da15594..ce15b4e 100644 --- a/macros/useQuery.macro.d.ts +++ b/macros/useQuery.macro.d.ts @@ -1,4 +1,4 @@ -import { CancelablePromise, Error } from "src/services/portal-api"; +import { CancelablePromise, Error } from "src/services/api"; //default export is a function /*