mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 15:05:35 +00:00
feat: recreate dashboard page from previous version
This commit is contained in:
12
inertia/hooks/use_search_param.tsx
Normal file
12
inertia/hooks/use_search_param.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { usePage } from '@inertiajs/react';
|
||||
|
||||
const useSearchParam = (urlParam: string) => {
|
||||
const { url } = usePage();
|
||||
const urlParams = url.split('?');
|
||||
urlParams.shift();
|
||||
|
||||
const urlSearchParam = new URLSearchParams(urlParams.join(''));
|
||||
return urlSearchParam.get(urlParam);
|
||||
};
|
||||
|
||||
export default useSearchParam;
|
||||
Reference in New Issue
Block a user