mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-06 04:26:57 +00:00
Fix UI :- Fix saved URL direct after login (#7799)
* Fix saved url direct after login * allow overriding store redirect path
This commit is contained in:
parent
cc94b58168
commit
986ce4a8b8
@ -139,16 +139,10 @@ export const AuthProvider = ({
|
||||
* Stores redirect URL for successful login
|
||||
*/
|
||||
function storeRedirectPath() {
|
||||
const redirectPathExists = Boolean(
|
||||
cookieStorage.getItem(REDIRECT_PATHNAME)
|
||||
);
|
||||
|
||||
if (!redirectPathExists) {
|
||||
cookieStorage.setItem(REDIRECT_PATHNAME, appState.getUrlPathname(), {
|
||||
expires: getUrlPathnameExpiry(),
|
||||
path: '/',
|
||||
});
|
||||
}
|
||||
cookieStorage.setItem(REDIRECT_PATHNAME, appState.getUrlPathname(), {
|
||||
expires: getUrlPathnameExpiry(),
|
||||
path: '/',
|
||||
});
|
||||
}
|
||||
|
||||
const resetUserDetails = (forceLogout = false) => {
|
||||
|
||||
@ -31,7 +31,10 @@ import {
|
||||
getResourcePermission,
|
||||
} from '../../axiosAPIs/permissionAPI';
|
||||
import { REDIRECT_PATHNAME } from '../../constants/constants';
|
||||
import { isProtectedRoute } from '../../utils/AuthProvider.util';
|
||||
import {
|
||||
getUrlPathnameExpiryAfterRoute,
|
||||
isProtectedRoute,
|
||||
} from '../../utils/AuthProvider.util';
|
||||
import {
|
||||
getOperationPermissions,
|
||||
getUIPermission,
|
||||
@ -84,7 +87,10 @@ const PermissionProvider: FC<PermissionProviderProps> = ({ children }) => {
|
||||
const redirectToStoredPath = () => {
|
||||
const urlPathname = cookieStorage.getItem(REDIRECT_PATHNAME);
|
||||
if (urlPathname) {
|
||||
cookieStorage.removeItem(REDIRECT_PATHNAME);
|
||||
cookieStorage.setItem(REDIRECT_PATHNAME, urlPathname, {
|
||||
expires: getUrlPathnameExpiryAfterRoute(),
|
||||
path: '/',
|
||||
});
|
||||
history.push(urlPathname);
|
||||
}
|
||||
};
|
||||
|
||||
@ -232,6 +232,10 @@ export const getUrlPathnameExpiry = () => {
|
||||
return new Date(Date.now() + 60 * 60 * 1000);
|
||||
};
|
||||
|
||||
export const getUrlPathnameExpiryAfterRoute = () => {
|
||||
return new Date(Date.now() + 1000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @exp expiry of token
|
||||
* @isExpired wether token is already expired or not
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user