Feature/remove use back to util (#360)
* Remove "useBackTo" Not needed * Use browser back navigation to close the reader This will cause the previous page (manga or updates) to be opened instead of always opening the manga page
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useNavBarContext } from '@/components/context/NavbarContext';
|
||||
|
||||
export const BACK = '__BACK__';
|
||||
|
||||
const useBackTo = (): { url?: string; back: boolean } => {
|
||||
const location = useLocation<{ backLink?: string }>();
|
||||
const { defaultBackTo } = useNavBarContext();
|
||||
|
||||
const url = location.state?.backLink ?? defaultBackTo;
|
||||
return {
|
||||
url: url === BACK ? undefined : url,
|
||||
back: url === BACK,
|
||||
};
|
||||
};
|
||||
|
||||
export default useBackTo;
|
||||
Reference in New Issue
Block a user