Skip to content

Commit

Permalink
[FIX]: corrected the spelling mistake in function name - ISSUE-44
Browse files Browse the repository at this point in the history
  • Loading branch information
Olga Yasnopolskaya committed Dec 3, 2024
1 parent c5d4338 commit a541fe2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const useNavigationAdapter = () => {
const pathname = usePathname();
const router = useRouter();

const creatUrlQueryParam = useCallback(
const createUrlQueryParam = useCallback(
(name: string, value: string) => {
const params = new URLSearchParams(searchParams.toString());
params.set(name, value);
Expand All @@ -30,7 +30,7 @@ const useNavigationAdapter = () => {
router,
redirect,
getUrlParams: (paramKeys: string[]) => paramKeys?.map((key) => searchParams.get(key)),
creatUrlQueryParam,
createUrlQueryParam,
removeUrlQueryParam,
urlParams: searchParams?.toString(),
pathname,
Expand Down
6 changes: 3 additions & 3 deletions src/v6y-front/src/commons/components/VitalitySearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import { VitalitySearchBarProps } from '../types/VitalitySearchBarProps';
const { Search } = Input;

const VitalitySearchBar = ({ helper, label, status, placeholder }: VitalitySearchBarProps) => {
const { router, pathname, getUrlParams, creatUrlQueryParam, removeUrlQueryParam } =
const { router, pathname, getUrlParams, createUrlQueryParam, removeUrlQueryParam } =
useNavigationAdapter();
const [searchText] = getUrlParams(['searchText']);

const handleOnSearchChanged = (value: string) => {
if (pathname === VitalityNavigationPaths.DASHBOARD) {
const queryParams = creatUrlQueryParam('searchText', value);
const queryParams = createUrlQueryParam('searchText', value);
router.push(`/search?${queryParams}`);
return;
}

if (value?.length) {
const queryParams = creatUrlQueryParam('searchText', value);
const queryParams = createUrlQueryParam('searchText', value);
router.replace(`${pathname}?${queryParams}`);
} else {
const queryParams = removeUrlQueryParam('searchText');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('VitalityAppInfos', () => {

beforeEach(() => {
useNavigationAdapter.mockReturnValue({
creatUrlQueryParam: vi.fn((key, value) => `${key}=${value}`),
createUrlQueryParam: vi.fn((key, value) => `${key}=${value}`),
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { VitalityAppInfosProps } from '../../types/VitalityAppInfosProps';
import VitalityLinks from '../VitalityLinks';

const VitalityAppInfos = ({ app, source, canOpenDetails = true, style }: VitalityAppInfosProps) => {
const { creatUrlQueryParam } = useNavigationAdapter();
const queryParams = creatUrlQueryParam('_id', `${app._id}`);
const { createUrlQueryParam } = useNavigationAdapter();
const queryParams = createUrlQueryParam('_id', `${app._id}`);
const appDetailsLink = source
? VitalityNavigationPaths.APP_DETAILS + '?' + queryParams + '&' + 'source=' + source
: VitalityNavigationPaths.APP_DETAILS + '?' + queryParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const VitalitySelectableIndicators = () => {
const [selectedIndicators, setSelectedIndicators] = useState<string[]>();
const [indicatorsList, setIndicatorsList] = useState<KeywordType[]>();

const { router, pathname, getUrlParams, creatUrlQueryParam, removeUrlQueryParam } =
const { router, pathname, getUrlParams, createUrlQueryParam, removeUrlQueryParam } =
useNavigationAdapter();
const [keywordsUrlParams] = getUrlParams(['keywords']);

Expand Down Expand Up @@ -62,7 +62,7 @@ const VitalitySelectableIndicators = () => {

const handleSelectedIndicator = (values: string[]) => {
if (values?.length) {
const queryParams = creatUrlQueryParam('keywords', values?.join(','));
const queryParams = createUrlQueryParam('keywords', values?.join(','));
router.replace(`${pathname}?${queryParams}`);
} else {
const queryParams = removeUrlQueryParam('keywords');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const useNavigationAdapter = () => {
const pathname = usePathname();
const router = useRouter();

const creatUrlQueryParam = useCallback(
const createUrlQueryParam = useCallback(
(name: string, value: string) => {
const params = new URLSearchParams(searchParams.toString());
params.set(name, value);
Expand All @@ -30,7 +30,7 @@ const useNavigationAdapter = () => {
router,
redirect,
getUrlParams: (paramKeys: string[]) => paramKeys?.map((key) => searchParams.get(key)),
creatUrlQueryParam,
createUrlQueryParam,
removeUrlQueryParam,
urlParams: searchParams?.toString(),
pathname,
Expand Down

0 comments on commit a541fe2

Please sign in to comment.