You should use the full URL.
window.location.assign(urlPath[0]+'/'+urlPath[1]+'/'+urlPath[2]+register);
window.location.assign(urlPath[0]+'/'+urlPath[1]+'/'+urlPath[2]+path);
Or
window.location.assign(window.location.origin+register);
window.location.assign(window.location.origin+path);