Skip to content

Commit

Permalink
Use apiUrl from damConfig as a temporary solution
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesricky committed Jul 23, 2024
1 parent f0355b3 commit 6d44a6a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from "react";
import { FieldRenderProps } from "react-final-form";
import { FormattedMessage } from "react-intl";

import { useCmsBlockContext } from "../../blocks/useCmsBlockContext";
import { GQLFinalFormFileUploadFragment } from "./FinalFormFileUpload.generated";

export const finalFormFileUploadFragment = gql`
Expand Down Expand Up @@ -33,8 +34,9 @@ export const FinalFormFileUpload = <MaxFiles extends number | undefined>({ input
const [tooManyFilesSelected, setTooManyFilesSelected] = React.useState(false);
const [uploadingFiles, setUploadingFiles] = React.useState<LoadingFileSelectItem[]>([]);
const [failedUploads, setFailedUploads] = React.useState<ErrorFileSelectItem[]>([]);

const apiUrl = "http://localhost:4000"; // TODO: Where do we get the url from? Env? Hook?
const {
damConfig: { apiUrl }, // TODO: Think of a better solution to get the apiUrl, as this has nothing to do with DAM
} = useCmsBlockContext();

const singleFile = maxFiles === 1;
const inputValue = React.useMemo(() => (Array.isArray(input.value) ? input.value : input.value ? [input.value] : []), [input.value]);
Expand Down

0 comments on commit 6d44a6a

Please sign in to comment.