const sender = Ethers.send("eth_requestAccounts", [])[0]; State.init({ forceReload: false, questLoadDone: false, }); console.log("myQuestList: ", state.myQuestList); const quest_url = `http://139.162.85.48:8100/get-action-by-account?account_id=${sender}&account_info=''`; const loadList = () => { if (sender) { asyncFetch(quest_url).then((res) => { const resQuest = JSON.parse(res.body); if (Number(resQuest.code) == 0) { State.update({ questLoadDone: true, myQuestList: resQuest.data, }); } }); } }; loadList(); const NoQuestWrapper = styled.div` .no-quest-tip { font-size: 16px; font-weight: 400; line-height: 19px; text-align: left; color: #979abe; padding: 0px 20px; display: flex; align-items: center; gap: 32px; .no-quest-tip-text { width: 471px; } .search-tip { position: relative; bottom: 32px; } .trends-tip { position: relative; top: 36px; } } `; const CardListWrapper = styled.div` display: flex; align-items: center; gap: 18px; flex-wrap: wrap; `; const onDelete = (action_id) => { asyncFetch("http://139.162.85.48:8100/delete-action-by_id", { method: "DELETE", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ action_id, }), }).then((res) => { if (res.status === 200) { loadList(); } }); }; if ( !state.myQuestList || (state.myQuestList.length === 0 && state.questLoadDone) ) { return ( <NoQuestWrapper> <div className="no-quest-tip"> <span className="no-quest-tip-text"> You can add a quest when making transaction, and the quest will be listed here after successful transaction. </span> <div className="search-tip">{searchTip}</div> <div className="trends-tip">{trendsTip}</div> </div> </NoQuestWrapper> ); } return ( <CardListWrapper> {(state.myQuestList || []).map((item, index) => { return ( <Widget key={item.action_id + "-" + index} src="ref-admin.near/widget/ZKEVMWarmUp.quest-card" props={{ item, onDelete: onDelete, }} /> ); })} </CardListWrapper> );