Skip to content

Commit

Permalink
Merge pull request #331 from zkLinkProtocol/fix/respin_issue
Browse files Browse the repository at this point in the history
fix daily draw issue
  • Loading branch information
zkLeonardo authored Jul 22, 2024
2 parents 3f80b00 + e129111 commit e98a24c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/components/DashboardS2/DailyRoulette/DailyDrawModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,14 @@ const DailyDrawModal: React.FC<IProps> = (props: IProps) => {
);
return;
}
//TODO call api
if (!modalInstance.isOpen) {
modalInstance.onOpen();
}
const res = await dailyOpen();
const tokenId = res.result.tokenId as number;
const prizeId = PRIZE_MAP[tokenId];
setSpinging(true);
onDrawed(); // update remain times
await drawRef.current?.start(prizeId);
const prize = PrizeItems[PRIZE_MAP[tokenId]];
setMintResult({
Expand All @@ -125,6 +128,7 @@ const DailyDrawModal: React.FC<IProps> = (props: IProps) => {
await sendTrademarkMintTx(mintParams);
setMintStatus(MintStatus.Success);
mintResultModal.onOpen();
onDrawed(); // update remain times after mint tx
} catch (e) {
console.log(e);
setMintStatus(MintStatus.Failed);
Expand All @@ -144,8 +148,8 @@ const DailyDrawModal: React.FC<IProps> = (props: IProps) => {
mintResultModal.onOpen();
setSpinging(false);
}
onDrawed();
if (remain === 1) {

if (!remain || remain <= 1) {
modalInstance.onClose();
}
}, [
Expand Down Expand Up @@ -215,7 +219,7 @@ const DailyDrawModal: React.FC<IProps> = (props: IProps) => {
<SpinButton
onClick={handleSpin}
isLoading={spinging}
disabled={minting || spinging}
disabled={minting || spinging || !remain}
>
<img
src={
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export default function Header() {
}, [address, signature]);

useEffect(() => {
if (signature) {
if (signature && !apiToken) {
getJWT();
}
}, [signature, apiToken]);
Expand Down
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default defineConfig({
port: 3001,
proxy: {
"/app-api": {
// target: "https://goerli.app.zklink.io",
target: "https://app-api.zklink.io",
target: "https://goerli.app.zklink.io",
// target: "https://app-api.zklink.io",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/app-api/, ""),
},
Expand Down

0 comments on commit e98a24c

Please sign in to comment.