mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
more formatting
This commit is contained in:
1 parent
046447b0fb
commit
f552c1212c
157 files changed
+635
-1579
No files matched your search
@@ -10,9 +10,7 @@ import { useLocation } from 'react-router-dom';
|
||||
*
|
||||
* const { id, title } = useQueryParams<{ id: string, title: string }>();
|
||||
*/
|
||||
export function useQueryParams<T = Record<string, string>>(
|
||||
defaultValues: T = null
|
||||
) {
|
||||
export function useQueryParams<T = Record<string, string>>(defaultValues: T = null) {
|
||||
const query = qs.parse(useLocation().search, { ignoreQueryPrefix: true });
|
||||
if (!defaultValues) {
|
||||
return query as T & Partial<ParsedQs>;
|
||||
|
||||
@@ -9,7 +9,7 @@ interface IRouterLocation {
|
||||
export const addQueryToLocation = (
|
||||
{ pathname = '', search = '' }: Record<string, unknown> & IRouterLocation,
|
||||
key = '',
|
||||
value = ''
|
||||
value = '',
|
||||
) => {
|
||||
const { query } = url(pathname + search);
|
||||
return `${pathname}?${qs.stringify({
|
||||
|
||||
@@ -8,7 +8,7 @@ interface IRouterLocation {
|
||||
|
||||
export const deleteQueryFromLocation = (
|
||||
location: Record<string, unknown> & IRouterLocation,
|
||||
key = ''
|
||||
key = '',
|
||||
) => {
|
||||
const { query } = url(location.pathname + location.search);
|
||||
return `${location.pathname}/?${qs.stringify({
|
||||
|
||||
Reference in new issue
Block a user