@@ -7,11 +7,13 @@ import React from 'react';
77
88import LoginButton from '../components/common/LoginButton' ;
99import Layout from '../components/layout' ;
10- import { acceptAndGetInvitedTeamByTokenApiMethod } from '../lib/api/public' ;
10+ import { getTeamByTokenApiMethod } from '../lib/api/public' ;
1111import { Team } from '../lib/store/team' ;
1212import { Store } from '../lib/store' ;
1313import withAuth from '../lib/withAuth' ;
1414
15+ const dev = process . env . NODE_ENV !== 'production' ;
16+
1517type Props = { store : Store ; team : Team ; token : string } ;
1618
1719class InvitationPageComp extends React . Component < Props > {
@@ -22,7 +24,7 @@ class InvitationPageComp extends React.Component<Props> {
2224 }
2325
2426 try {
25- const { team } = await acceptAndGetInvitedTeamByTokenApiMethod ( token , ctx . req ) ;
27+ const { team } = await getTeamByTokenApiMethod ( token , ctx . req ) ;
2628
2729 return { team, token } ;
2830 } catch ( error ) {
@@ -74,18 +76,19 @@ class InvitationPageComp extends React.Component<Props> {
7476 }
7577
7678 public async componentDidMount ( ) {
77- const { store, team } = this . props ;
79+ const { store, team, token } = this . props ;
7880
7981 const user = store . currentUser ;
8082
8183 if ( user && team ) {
82- if ( team . memberIds . includes ( user . _id ) ) {
83- const redirectMessage = `Success%21%20You%20are%20now%20part%20of%20${ team . name } %20team%2E` ;
84- Router . push (
85- `/your-settings?teamSlug=${ team . slug } &redirectMessage=${ redirectMessage } ` ,
86- `/teams/${ team . slug } /your-settings` ,
87- ) ;
88- }
84+ Router . push (
85+ `${
86+ dev ? process . env . NEXT_PUBLIC_URL_API : process . env . NEXT_PUBLIC_PRODUCTION_URL_API
87+ } /logout?invitationToken=${ token } `,
88+ `${
89+ dev ? process . env . NEXT_PUBLIC_URL_API : process . env . NEXT_PUBLIC_PRODUCTION_URL_API
90+ } /logout`,
91+ ) ;
8992 }
9093 }
9194}
0 commit comments