diff --git a/public/app/core/components/sidemenu/SignIn.test.tsx b/public/app/core/components/sidemenu/SignIn.test.tsx index c202926086f..69144e1f8fc 100644 --- a/public/app/core/components/sidemenu/SignIn.test.tsx +++ b/public/app/core/components/sidemenu/SignIn.test.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { shallow } from 'enzyme'; -import SignIn from './SignIn'; +import { SignIn } from './SignIn'; describe('Render', () => { it('should render component', () => { - const wrapper = shallow(); + const wrapper = shallow(); expect(wrapper).toMatchSnapshot(); }); diff --git a/public/app/core/components/sidemenu/SignIn.tsx b/public/app/core/components/sidemenu/SignIn.tsx index 50b3aef2d9b..d59ad53af03 100644 --- a/public/app/core/components/sidemenu/SignIn.tsx +++ b/public/app/core/components/sidemenu/SignIn.tsx @@ -1,7 +1,9 @@ import React, { FC } from 'react'; +import { connectWithStore } from 'app/core/utils/connectWithReduxStore'; +import { StoreState } from 'app/types'; -const SignIn: FC = () => { - const loginUrl = `login?redirect=${encodeURIComponent(window.location.pathname)}`; +export const SignIn: FC = ({ url }) => { + const loginUrl = `login?redirect=${encodeURIComponent(url)}`; return (
@@ -20,4 +22,8 @@ const SignIn: FC = () => { ); }; -export default SignIn; +const mapStateToProps = (state: StoreState) => ({ + url: state.location.url, +}); + +export default connectWithStore(SignIn, mapStateToProps); diff --git a/public/app/core/components/sidemenu/__snapshots__/BottomSection.test.tsx.snap b/public/app/core/components/sidemenu/__snapshots__/BottomSection.test.tsx.snap index ea92e8b7343..57f081e1327 100644 --- a/public/app/core/components/sidemenu/__snapshots__/BottomSection.test.tsx.snap +++ b/public/app/core/components/sidemenu/__snapshots__/BottomSection.test.tsx.snap @@ -4,7 +4,7 @@ exports[`Render should render component 1`] = `
- +