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:
schroda
2023-06-08 14:25:24 +02:00
committed by GitHub
parent 87de016d6f
commit 63c1ac95eb
7 changed files with 9 additions and 50 deletions

View File

@@ -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;