Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit c2ab9b9

Browse files
committed
Added Redirect helper
1 parent 3263151 commit c2ab9b9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const internRedirect = (event: { preventDefault: () => void; }, history: any, path: string): void => {
2+
event.preventDefault();
3+
if (path) {
4+
const element = document.getElementById(path)
5+
if (element) {
6+
element.scrollIntoView()
7+
}
8+
}
9+
};
10+
const externRedirect = (event: { preventDefault: () => void; }, history: any[], path: string): void => {
11+
event.preventDefault();
12+
history.push(path);
13+
};
14+
15+
export {externRedirect, internRedirect}

0 commit comments

Comments
 (0)