Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: get route info function #289

merged 2 commits into from
Aug 18, 2021


Copy link

@sarkaaa sarkaaa commented Aug 17, 2021

This PR implements a helper function for getting route info.

How to use:

  1. Import a helper function (and route info props):
import { getRouteInfo, RouteInfoResultProps } from "../src/helperFunctions";
  1. Set useState hook for data from API:
const [routeInfo, setRouteInfo] = useState<null | RouteInfoResultProps>(null);
  1. Call the helper function:
const fetchRouteInfo = useCallback(async () => {
  const info = await getRouteInfo(coords, params as any);
}, []);
  1. Don't forget set useEffect function:
useEffect(() => {
}, []);
  1. Tada. 馃帀 Route info is set in routeInfo const and you can use it now.

鈿狅笍 CI issues:
I'm getting some CI issues here at GitHub. When I tried run npm run predeploy locally, I'm not getting any error (I'm locally using the same version of npm and nodejs). Honestly, I don't understand the error message from codeclimate, I've noticed that other functions in this project have more lines than mine and they pass ok. Could you take a look at it, please? 馃檹

Copy link

@sarkaaa You missed some imports, fixed it for you and merging.

Copy link

Thank you for your contribution, love your work 馃槉

@kolebjak kolebjak merged commit c2228e0 into kolebjak:master Aug 18, 2021
Copy link
Contributor Author

sarkaaa commented Aug 18, 2021

@kolebjak Oh, I know where was an error. 馃槵 I did a mistake in the commit process. Thanks for the fixing and merging! 馃槉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants