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:
parent
bc6a08fac2
commit
9d865909d0
2 changed files with 9 additions and 1 deletions
|
@ -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}`));
|
||||||
|
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue