Skip to content

Commit

Permalink
added address argument to useClearLocalStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
mikestarrdev committed Jun 29, 2023
1 parent 14f4c25 commit b23b21a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/TransactionsTab/TransactionsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const TransactionsTab = ({

const handleClearTransactions = () => {
dispatch(setTransactions(null));
clearLocalStorage('airswap/transactions')
clearLocalStorage(address)
};

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const clearLocalStorage = (prefix: string) => {
export const clearLocalStorage = (address: string) => {
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
if (key?.startsWith(prefix)) {
if (key?.includes(`airswap/transactions/${address}`)) {
localStorage.removeItem(key)
}
}
Expand Down

0 comments on commit b23b21a

Please sign in to comment.