Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes lost session #32

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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