Redirect after logout in React SPA

Problem statement

I have a SPA in React where the logout function:

logout({
  logoutParams: {
        returnTo: window.location.origin
  }
})

I have 2 Allowed Logout URLs: https://abcde.cloudfront.net, http://localhost:3000 configured
The problem is no matter what environment I am using when I am doing the redirect, is not redirect me to “window.location.origin”, but is redirecting me to the first URL in the list.

Solution

const logoutWithRedirect = () =>
    logout({
      returnTo: window.location.origin,
    });