Skip to content

Commit eafea52

Browse files
authored
Replace history with window.location (#67)
Signed-off-by: Aravinda Vishwanathapura <[email protected]>
1 parent 1e53b7c commit eafea52

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

ui/src/pages/bricks.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function Bricks({ history }) {
6565
})
6666
.catch(err => {
6767
if (err.response.status === 403) {
68-
history.push('/login');
68+
window.location = '/login';
6969
} else {
7070
setLoading(false);
7171
setError("Failed to get data from the server(HTTP Status: " + err.response.status + ")");

ui/src/pages/dashboard.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ function dashboardUI(history, volumes, peers) {
3838
}
3939
return (
4040
<div className="">
41-
<Box label="Peers" value={upPeers + ' / ' + peers.length} onClick={() => history.push('/peers')}/>
42-
<Box label="Volumes" value={upVolumes + ' / ' + volumes.length} onClick={() => history.push('/volumes')}/>
43-
<Box label="Bricks" value={upBricks + ' / ' + numBricks} onClick={() => history.push('/bricks')}/>
41+
<Box label="Peers" value={upPeers + ' / ' + peers.length} onClick={() => window.location = '/peers'}/>
42+
<Box label="Volumes" value={upVolumes + ' / ' + volumes.length} onClick={() => window.location = '/volumes'}/>
43+
<Box label="Bricks" value={upBricks + ' / ' + numBricks} onClick={() => window.location = '/bricks'}/>
4444
</div>
45-
);
45+
);
4646
}
4747

4848
export function Dashboard({ history }) {
@@ -64,7 +64,7 @@ export function Dashboard({ history }) {
6464
})
6565
.catch(err => {
6666
if (err.response.status === 403) {
67-
history.push('/login');
67+
window.location = '/login';
6868
} else {
6969
setLoading(false);
7070
setError("Failed to get data from the server(HTTP Status: " + err.response.status + ")");
@@ -77,7 +77,7 @@ export function Dashboard({ history }) {
7777
})
7878
.catch(err => {
7979
if (err.response.status === 403) {
80-
history.push('/login');
80+
window.location = '/login';
8181
}
8282
});
8383
}, [refreshRequired, history]);

ui/src/pages/login.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function Login({ history }) {
1818
useEffect(() => {
1919
axios.get("/api/login")
2020
.then((resp) => {
21-
history.push('/dashboard');
21+
window.location = '/dashboard';
2222
});
2323
}, [history]);
2424

@@ -36,7 +36,7 @@ export function Login({ history }) {
3636
username: username,
3737
password: password
3838
}).then(res => {
39-
history.push('/dashboard');
39+
window.location = '/dashboard';
4040
}).catch(err => {
4141
if (err.response.status === 403) {
4242
setError("Invalid username/password");

ui/src/pages/logout.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function Logout({ history }) {
1010
.then((resp) => {
1111
setMessage("Logged out Successfully...");
1212
setInterval(() => {
13-
history.push('/login');
13+
window.location = '/login';
1414
}, 2000);
1515
}).catch(err => {
1616
setError("Failed to get data from the server(HTTP Status: " + err.response.status + ")");

ui/src/pages/peers.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function Peers({ history }) {
6161
})
6262
.catch(err => {
6363
if (err.response.status === 403) {
64-
history.push('/login');
64+
window.location = '/login';
6565
} else {
6666
setLoading(false);
6767
setError("Failed to get data from the server(HTTP Status: " + err.response.status + ")");

ui/src/pages/volumeDetail.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export function VolumeDetail({ history }) {
134134
})
135135
.catch(err => {
136136
if (err.response.status === 403) {
137-
history.push('/login');
137+
window.location = '/login';
138138
} else {
139139
setLoading(false);
140140
setError("Failed to get data from the server(HTTP Status: " + err.response.status + ")");

ui/src/pages/volumes.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function Volumes({ history }) {
5959
})
6060
.catch(err => {
6161
if (err.response.status === 403) {
62-
history.push('/login');
62+
window.location = '/login';
6363
} else {
6464
setLoading(false);
6565
setError("Failed to get data from the server(HTTP Status: " + err.response.status + ")");

0 commit comments

Comments
 (0)