Skip to content

Commit

Permalink
fix(State): Updated dapps key
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesGuesnon committed Nov 22, 2023
1 parent cf204b7 commit 14da13f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions context/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@ function reducer(state: tezosState, action: action): tezosState {

state.connectedDapps[action.payload.address] ??= {};

state.connectedDapps[action.payload.address][
`${action.payload.data.appUrl}-${state.address}`
] = action.payload.data;
state.connectedDapps[action.payload.address][action.payload.data.appUrl] =
action.payload.data;

saveState(state);

Expand All @@ -188,17 +187,13 @@ function reducer(state: tezosState, action: action): tezosState {
case "removeDapp": {
if (
!state.currentContract ||
!state.connectedDapps[state.currentContract][
`${action.payload}-${state.address}`
]
!state.connectedDapps[state.currentContract][action.payload]
)
return state;

const newState = { ...state };

delete newState.connectedDapps[state.currentContract][
`${action.payload}-${state.address}`
];
delete newState.connectedDapps[state.currentContract][action.payload];

saveState(newState);

Expand Down

0 comments on commit 14da13f

Please sign in to comment.