0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix: remove connector link from session storage (#4406)

This commit is contained in:
Jasdeep Singh 2023-08-29 16:34:46 +05:30 committed by GitHub
parent bc6a08fac2
commit 9d865909d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -1,7 +1,10 @@
import { useCallback } from 'react'; import { useCallback } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { getCallbackLinkFromStorage } from '@/utils/social-connectors'; import {
getCallbackLinkFromStorage,
removeCallbackLinkFromStorage,
} from '@/utils/social-connectors';
const useSocialCallbackHandler = () => { const useSocialCallbackHandler = () => {
const navigate = useNavigate(); const navigate = useNavigate();
@ -19,6 +22,7 @@ const useSocialCallbackHandler = () => {
// Get native callback link from storage // Get native callback link from storage
const callbackLink = getCallbackLinkFromStorage(connectorId); const callbackLink = getCallbackLinkFromStorage(connectorId);
removeCallbackLinkFromStorage(connectorId);
if (callbackLink) { if (callbackLink) {
window.location.replace(new URL(`${callbackLink}${search}`)); window.location.replace(new URL(`${callbackLink}${search}`));

View file

@ -56,6 +56,10 @@ export const getCallbackLinkFromStorage = (connectorId: string) => {
return sessionStorage.getItem(`${storageCallbackLinkKeyPrefix}:${connectorId}`); return sessionStorage.getItem(`${storageCallbackLinkKeyPrefix}:${connectorId}`);
}; };
export const removeCallbackLinkFromStorage = (connectorId: string) => {
sessionStorage.removeItem(`${storageCallbackLinkKeyPrefix}:${connectorId}`);
};
/** /**
* Social Connectors Filter Utility Methods * Social Connectors Filter Utility Methods
*/ */