mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-28 14:04:43 -04:00
Switch the base framework from Create React App to Next.JS
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
a979b6ffdd
commit
77a60c6c48
361 changed files with 5130 additions and 9605 deletions
17
src/hooks/common/use-array-string-url-parameter.ts
Normal file
17
src/hooks/common/use-array-string-url-parameter.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { useRouter } from 'next/router'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
export const useArrayStringUrlParameter = (parameter: string): string[] => {
|
||||
const router = useRouter()
|
||||
|
||||
return useMemo(() => {
|
||||
const value = router.query[parameter]
|
||||
return (typeof value === 'string' ? [value] : value) ?? []
|
||||
}, [parameter, router.query])
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue