Add contacts referal after creating from dialer

This commit is contained in:
J Francisco Rader committed 2021-02-21 19:34:36 -05:00
1 parent 1650929eed
commit 3171052963
3 files changed
+13 -7

No files matched your search

+8 -3
View File
@@ -10,7 +10,12 @@ import { useLocation } from 'react-router-dom';
*
* const { id, title } = useQueryParams<{ id: string, title: string }>();
*/
export function useQueryParams<T = Record<string, string>>() {
return qs.parse(useLocation().search, { ignoreQueryPrefix: true }) as T &
Partial<ParsedQs>;
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>;
}
return { ...defaultValues, ...query } as T & Partial<ParsedQs>;
}