Skip to content

Commit

Permalink
fix: check post query fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
blushi committed Sep 11, 2024
1 parent d890f46 commit 7d0d7a7
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const PostFlow = ({
const { activeAccount } = useAuth();
const [isFormModalOpen, setIsFormModalOpen] = useState(true);
const [iri, setIri] = useState<string | undefined>();
const { data: createdPostData } = useQuery(
const { data: createdPostData, isFetching } = useQuery(
getPostQuery({
iri,
enabled: !!iri,
Expand Down Expand Up @@ -113,7 +113,6 @@ export const PostFlow = ({
};
});
try {
console.log(data.published);
await postData({
url: `${apiServerUrl}/marketplace/v1/posts${
draftPostIri ? `/${draftPostIri}` : ''
Expand Down Expand Up @@ -174,9 +173,8 @@ export const PostFlow = ({

const hasAddress =
!!wallet?.address && activeAccount?.addr === wallet.address;
console.log('createdPostData', createdPostData);
useEffect(() => {
if (iri && createdPostData) {
if (iri && createdPostData && !isFetching) {
setIsFormModalOpen(false);
if (createdPostData.published) {
if (hasAddress) {
Expand Down Expand Up @@ -205,8 +203,9 @@ export const PostFlow = ({
draftPostIri,
fetchMsgAnchor,
hasAddress,
initialValues?.iri,
initialValues.iri,
iri,
isFetching,
navigate,
offChainProjectId,
onModalClose,
Expand Down

0 comments on commit 7d0d7a7

Please sign in to comment.