From b26a45e588b9d97c3db17bd22ece52741b1d08e3 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Wed, 27 Dec 2023 01:36:00 +0530 Subject: [PATCH] fix(#1137): Display created bounty after successful bounty creation (#1191) * fix(#1137): Display created bounty after successful bounty creation * fix(#1137): Display created bounty after successful bounty creation * Removed window reload * formatting --- .../src/people/widgetViews/postBounty/PostModal.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/app/src/people/widgetViews/postBounty/PostModal.tsx b/frontend/app/src/people/widgetViews/postBounty/PostModal.tsx index 06efbd1a1..753649175 100644 --- a/frontend/app/src/people/widgetViews/postBounty/PostModal.tsx +++ b/frontend/app/src/people/widgetViews/postBounty/PostModal.tsx @@ -1,4 +1,4 @@ -import React, { FC, useState } from 'react'; +import React, { FC, useState, useCallback } from 'react'; import { useHistory } from 'react-router-dom'; import { observer } from 'mobx-react-lite'; import { colors } from '../../../config/colors'; @@ -29,12 +29,17 @@ export const PostModal: FC = observer( const canEdit = id === ui.meInfo?.id; const config = widgetConfigs[widget]; + const getBountyData = useCallback(async () => { + const response = await main.getPeopleBounties(); + return response[0].body.id; + }, [main]); + const ReCallBounties = async () => { /* TODO : after getting the better way to reload the bounty, this code will be removed. */ - history.push('/bounties'); - await window.location.reload(); + const number = await getBountyData(); + history.push(`/bounty/${number}`); }; const closeHandler = () => {