From React i'm Not able to Login Into Frappe.

In React i’m trying directly to get into the Frappe application.
When i use the window.location.href = ‘path’ that time it’s routing to frappe & it’s showing 403 error

But in frappe when i login and then try to signin from the react.Then it’s routing to frappe application directly

@frappe.whitelist(allow_guest=True)
def login(usr, pwd):
try:
url = ‘http://hrmss:8010/api/method/login
data = {‘usr’: usr, ‘pwd’: pwd}
headers = {‘Content-Type’: ‘application/json’}

    response = requests.post(url, json=data, headers=headers, cookies=frappe.local.session.cookies)
    response.raise_for_status()

    if response.json().get('message') == 'Logged In':
        return {'url': 'http://hrmss:8010/app'}
    else:
        return {'error': 'Login failed', 'message': response.json().get('message')}
except requests.exceptions.RequestException as e:
    return {'error': 'Request failed', 'message': str(e)}

const handleSubmit = async (event: React.FormEvent) => {
event.preventDefault();

try {
  const response = await fetch('http://hrmss:8010/api/method/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    credentials: 'include',
    body: JSON.stringify({
      usr: email,
      pwd: password
    }),
  });

  const data = await response.json();
  console.log('Response Data:', data);

  if (data.message === 'Logged In') {
    const siteData = {
        usr: email,
        pwd: password
    };

    try {
      const response12 = await axios.post('http://hrmss:8010/api/method/hrms.api.site_testing.login', siteData, {
        headers: {
          'Content-Type': 'application/json',
        },
        withCredentials: true,
      });

      const { url } = response12.data;
      console.log("Redirecting to:", url);
      window.location.href = 'http://hrmss:8010/app';
    } catch (innerError) {
      console.error('Error in site login API call:', innerError);
      alert('An error occurred during site login. Please try again.');
    }
  } else {
    alert('Login failed: ' + data.message);
  }
} catch (error) {
  console.error('Error in login API call:', error);
  alert('An error occurred. Please try again.');
}

};