Skip to content

Commit

Permalink
Merge pull request #32 from magiclabs/PDEEXP-2080-fix-wagmi-integration
Browse files Browse the repository at this point in the history
fixes lost session
  • Loading branch information
joshuascan authored Nov 26, 2024
2 parents c0ffea2 + 01e3650 commit 496d7e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/lib/connectors/dedicatedWalletConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export function dedicatedWalletConnector({
disconnect: async () => {
try {
const magic = getMagicSDK()
await magic?.wallet.disconnect()
await magic?.user.logout()
localStorage.removeItem('magicRedirectResult')
config.emitter.emit('disconnect')
} catch (error) {
Expand Down Expand Up @@ -222,13 +222,12 @@ export function dedicatedWalletConnector({
}

const isLoggedIn = await magic.user.isLoggedIn()
if (isLoggedIn) return true

const result = await magic.oauth.getRedirectResult()
if (result) {
localStorage.setItem('magicRedirectResult', JSON.stringify(result))
}

if (isLoggedIn) return true

return result !== null
} catch {}
return false
Expand Down
12 changes: 8 additions & 4 deletions src/lib/modal/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ export const modalStyles = (accentColor = '#6452f7') => `
.Magic__closeButton {
position: absolute;
top: 0;
width: 40px;
height: 40px;
top: 15px;
right: 15px;
padding: 10px;
padding: 6px 10px 10px 10px;
border: none;
background-color: transparent;
cursor: pointer;
Expand Down Expand Up @@ -120,6 +123,7 @@ export const modalStyles = (accentColor = '#6452f7') => `
text-align: center;
color: #D6D6D6;
font-size: 14px;
margin-bottom: 8px;
}
.Magic__dark .Magic__divider {
color: #444;
Expand Down Expand Up @@ -147,13 +151,13 @@ export const modalStyles = (accentColor = '#6452f7') => `
align-items: center;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
gap: 20px;
width: 90%;
}
.Magic__oauthButton{
display: block;
padding: 5px;
border: none;
width: fit-content;
padding: 0;
background-color: transparent;
cursor: pointer;
border-radius: 100px;
Expand Down

0 comments on commit 496d7e0

Please sign in to comment.