File tree Expand file tree Collapse file tree
App/Login/LoginByGithubCallback Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,15 +19,16 @@ export const LoginByGithubCallback: React.FC = () => {
1919 const [ searchParams ] = useSearchParams ( ) ;
2020 const navigate = useNavigate ( ) ;
2121 const code = searchParams . get ( 'code' ) ;
22+ const state = searchParams . get ( 'state' ) ;
2223 const [ isInvalidCode , setIsInvalidCode ] = useState ( false ) ;
2324 const dispatch = useAppDispatch ( ) ;
2425
2526 const [ githubCallback ] = useGithubCallbackMutation ( ) ;
2627 const [ getProjects ] = useLazyGetProjectsQuery ( ) ;
2728
2829 const checkCode = ( ) => {
29- if ( code ) {
30- githubCallback ( { code } )
30+ if ( code && state ) {
31+ githubCallback ( { code, state } )
3132 . unwrap ( )
3233 . then ( async ( { creds : { token } } ) => {
3334 dispatch ( setAuthData ( { token } ) ) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export const authApi = createApi({
1919 } ) ,
2020 } ) ,
2121
22- githubCallback : builder . mutation < IUserWithCreds , { code : string } > ( {
22+ githubCallback : builder . mutation < IUserWithCreds , { code : string ; state : string } > ( {
2323 query : ( body ) => ( {
2424 url : API . AUTH . GITHUB . CALLBACK ( ) ,
2525 method : 'POST' ,
You can’t perform that action at this time.
0 commit comments