From b62ab25c4155260e8bfe32c71e59bf7b482ce589 Mon Sep 17 00:00:00 2001 From: Tobias Skarhed Date: Sat, 3 Aug 2019 16:21:17 +0200 Subject: [PATCH] SignIn: Update redirect on reroute (#18360) * Connect SignIn with redux and get url * Update test snapshot --- public/app/core/components/sidemenu/SignIn.test.tsx | 4 ++-- public/app/core/components/sidemenu/SignIn.tsx | 12 +++++++++--- .../__snapshots__/BottomSection.test.tsx.snap | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) 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 (