@@ -45,11 +45,12 @@ class Auth extends Component {
4545 this . envVidispineUrl = getVidispineUrlFromEnv ( ) ;
4646 this . pathVidispineUrl = getVidispineUrlFromPath ( ) ;
4747 this . useContainerProxy = getContainerProxyFromWindow ( ) ;
48- const baseURL =
48+ let baseURL =
4949 this . pathVidispineUrl ||
5050 this . windowVidispineUrl ||
5151 this . envVidispineUrl ||
5252 this . cookieVidispineUrl ;
53+ if ( baseURL ) baseURL = baseURL . replace ( / \/ + $ / , '' ) ;
5354 this . useDevProxy =
5455 this . useContainerProxy === undefined &&
5556 baseURL !== undefined &&
@@ -108,17 +109,19 @@ class Auth extends Component {
108109 } ;
109110 }
110111
111- setUserName ( userName , baseURL ) {
112+ setUserName ( userName , propsBaseURL ) {
113+ const baseURL = propsBaseURL . replace ( / \/ + $ / , '' ) ;
112114 const { cookies } = this . props ;
113115 const path = setCookiePath ( baseURL ) ;
114116 cookies . set ( AUTH_USERNAME , userName , { path } ) ;
115117 this . setState ( { userName } ) ;
116118 }
117119
118- setToken ( token , baseURL ) {
120+ setToken ( token , propsBaseURL ) {
121+ const baseURL = propsBaseURL . replace ( / \/ + $ / , '' ) ;
119122 const { cookies } = this . props ;
120123 const path = setCookiePath ( baseURL ) ;
121- cookies . set ( AUTH_TOKEN , token , { path : setCookiePath ( baseURL ) } ) ;
124+ cookies . set ( AUTH_TOKEN , token , { path } ) ;
122125 cookies . set ( AUTH_IS_AUTHENTICATED , true , { path : APP_BASENAME } ) ;
123126 api . defaultClient . defaults . headers . Authorization = `token ${ token } ` ;
124127 this . setState ( { token } ) ;
@@ -166,7 +169,8 @@ class Auth extends Component {
166169 this . setState ( { runAs } ) ;
167170 }
168171
169- setBaseUrl ( baseURL ) {
172+ setBaseUrl ( propsBaseURL ) {
173+ const baseURL = propsBaseURL . replace ( / \/ + $ / , '' ) ;
170174 const { cookies } = this . props ;
171175 cookies . set ( AUTH_VIDISPINE_SERVER_URL , baseURL , { path : APP_BASENAME } ) ;
172176 if ( this . windowVidispineUrl !== baseURL ) this . useDevProxy = false ;
0 commit comments