Skip to content

Commit

Permalink
fix(#1137): Display created bounty after successful bounty creation (#…
Browse files Browse the repository at this point in the history
…1191)

* fix(#1137): Display created bounty after successful bounty creation

* fix(#1137): Display created bounty after successful bounty creation

* Removed window reload

* formatting
  • Loading branch information
Vayras authored Dec 26, 2023
1 parent 42b8154 commit b26a45e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions frontend/app/src/people/widgetViews/postBounty/PostModal.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -29,12 +29,17 @@ export const PostModal: FC<PostModalProps> = 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 = () => {
Expand Down

0 comments on commit b26a45e

Please sign in to comment.