Skip to content

Commit

Permalink
WIP fix: third-party cookies error
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jun 5, 2023
1 parent 1d8ce13 commit 446bf4e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions wallet/src/bridge-dapp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,26 +160,21 @@ const connectDapp = async () => {
});
};

const sendCookiesDisabledError = () => {
const sendAccessDisabledError = () => {
sendMessage({
type: BridgeProtocol.error,
message: 'Please enable cross-site cookies to use this functionality.',
// TODO counsel on how to fix
message: 'Failed to connect to dapp.',
});
};

const Bridge = () => {
useEffect(() => {
const tryConnect = async () => {
if ('requestStorageAccess' in document) {
if (await document.hasStorageAccess()) {
return connectDapp();
} else {
sendCookiesDisabledError();
}
} else if ('localStorage' in window) {
if ('localStorage' in window) {
return connectDapp();
} else {
sendCookiesDisabledError();
sendAccessDisabledError();
}
};
void tryConnect();
Expand Down

0 comments on commit 446bf4e

Please sign in to comment.