Skip to content

Commit

Permalink
Problem with council page not refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
ndkazu committed Mar 26, 2024
1 parent 19c0a47 commit 5349454
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
18 changes: 7 additions & 11 deletions fs-dapp_2.0/src/components/pages/Council.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export default function Council() {

let acc_list = proposals;
if (acc && !acc_list.includes(acc1 as InjectedAccountWithMeta) && acc1){
acc_list.push(acc1);
acc_list.push(acc1);
dispatch1({type:`SET_PROPOSALS`,payload:[]});
dispatch1({type:`SET_PROPOSALS`,payload:acc_list});


Expand Down Expand Up @@ -96,34 +97,29 @@ export default function Council() {
if (hash.length > 0) {
setHash0(hash);
update()
console.log(`Number of active proposals: ${proposals.length}`)

}
});


}, [hash0,blocks,selectedAccount,api]);

return(<div id="scrollableDiv"
style={{
height: 400,
overflow: 'auto',
padding: '0 16px',
border: '1px solid rgba(140, 140, 140, 0.35)',
}}>
<InfiniteScroll
dataLength={proposals.length}
next={update}
hasMore={proposals.length < 50}
loader={<Skeleton avatar paragraph={{ rows: 1 }} active />}
endMessage={<Divider plain>It is all, nothing more 🤐</Divider>}
scrollableTarget="scrollableDiv"
>

<List
dataSource={data}

renderItem={item => (
<Card
hoverable
style={{ width: 300 }}>
style={{ width: 300, height:120}}>
<List.Item key={item.address}>
<List.Item.Meta
title={<p>{item.name}</p>}
Expand All @@ -136,7 +132,7 @@ export default function Council() {

/>

</InfiniteScroll>

<Button
type="primary"
className="bg-blue-600 text-white font-bold py-2 text-xl"
Expand Down
10 changes: 7 additions & 3 deletions fs-dapp_2.0/src/components/pages/Roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ export default function Roles() {
let address0 = selectedAccount.address;
api.query.rolesModule.requestedRoles(address0, (data: any) => {
let data0 = data.toHuman();
if(!data0) return;
console.log(`requested roles:${data}`);
if(data0) {
console.log(`requested roles:${data}`);
let r_session = data0.role.toString();

dispatch1({ type: 'SET_ROLE_IN_SESSION', payload: r_session });
}else{
dispatch1({ type: 'SET_ROLE_IN_SESSION', payload: `` });
}

});
console.log(`role in session:${role_in_session}`)
}, [selectedAccount, blocks, dispatch1, api]);
}, [role_in_session,selectedAccount, blocks, dispatch1, api]);

useEffect(() => {
if (!api || !selectedAccount) return;
Expand Down

0 comments on commit 5349454

Please sign in to comment.