mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
refactored hooks directory
This commit is contained in:
parent
efa3ba902d
commit
f76a5a4798
106 changed files with 122 additions and 144 deletions
|
@ -1,24 +0,0 @@
|
|||
import { useEffect } from 'react';
|
||||
import { history } from '~/redux/store';
|
||||
|
||||
/**
|
||||
* useBlockBackButton - blocks back navigation and calls {callback}
|
||||
* @param callback
|
||||
*/
|
||||
export const useBlockBackButton = (callback?: () => void) => {
|
||||
useEffect(
|
||||
() =>
|
||||
history.listen((newLocation, action) => {
|
||||
if (action !== 'POP') {
|
||||
return;
|
||||
}
|
||||
|
||||
history.goForward();
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}),
|
||||
[callback]
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue