mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-22 19:25:18 -04:00
Extract windows location code into hook (#808)
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
a24ef18dd4
commit
bc7ff07256
2 changed files with 17 additions and 5 deletions
13
src/hooks/common/use-frontend-base-url.ts
Normal file
13
src/hooks/common/use-frontend-base-url.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useLocation } from 'react-router'
|
||||
|
||||
export const useFrontendBaseUrl = (): string => {
|
||||
const { pathname } = useLocation()
|
||||
|
||||
return window.location.pathname.replace(pathname, '')
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue