Skip to content

Commit

Permalink
'window.location' -> 'location.'
Browse files Browse the repository at this point in the history
  • Loading branch information
sssomeshhh committed May 27, 2024
1 parent d995fb8 commit b1b4019
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions fe/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const Header = () => {
sessionStorage.removeItem('email');
sessionStorage.removeItem('token');
sessionStorage.removeItem('role');
window.location.href = window.location.origin;
window.location.reload();
location.href = location.origin;
location.reload();
alert("Logging out " + email + "...")
};

Expand Down
2 changes: 1 addition & 1 deletion fe/src/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Login = ({ onClose }) => {
});
};
if (!open) {
window.location.href = "/";
location.href = "/";
}
return (
<div>
Expand Down
6 changes: 3 additions & 3 deletions fe/src/components/PropertyDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const PropertyDetail = () => {

const handleSubmit = (e) => {
e.preventDefault();
apiRequest('POST', window.location, { data: detail, headers: { ...getAuthHeader() } })
apiRequest('POST', location, { data: detail, headers: { ...getAuthHeader() } })
.then((res) => {
console.log('Property updated!', res.data);
})
Expand Down Expand Up @@ -96,12 +96,12 @@ const PropertyDetail = () => {
.then((res) => {
console.log("Property deleted!", res.data);
alert("Property deleted!");
window.location.href = window.location.origin + '/property/list';
location.href = location.origin + '/property/list';
})
.catch((err) => {
console.error("There was an error deleting the property!", err);
alert("There was an error deleting the property!");
window.location.href = window.location.origin + '/property/list';
location.href = location.origin + '/property/list';
});
};

Expand Down
6 changes: 3 additions & 3 deletions fe/src/components/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const Register = () => {
.then((res) => {
console.log('Registered successfully!', res.data);
alert('Registered Successfully! Please Login!');
window.location.href = window.location.origin;
location.href = location.origin;
})
.catch((err) => {
console.error('There was an error registering!', err);
alert('Cannot Register! Please Try Again!');
window.location.href = window.location.origin;
location.href = location.origin;
});
};

Expand All @@ -34,7 +34,7 @@ const Register = () => {
<span className="text" style={{flexGrow: "1"}}>SignUp</span>
<div style={{display: "flex", flexDirection: "row", justifySelf: "end", alignSelf: "start"}}>
<a href="/" onClick={() => {
window.location.href = window.location.origin;
location.href = location.origin;
}} style={{justifyContent: "space-between", alignItems: "flex-end"}}>
<img style={{width: "1cm"}} src={closeIcon} alt="X"/>
</a>
Expand Down

0 comments on commit b1b4019

Please sign in to comment.