fingerprintjs / fingerprintjs-pro-react

Fingerprint Pro Wrapper for React Single Page Applications (SPA)
MIT License
52 stars 8 forks source link

Put extra arguments for the getData callback #108

Closed vladyslavKucheruk closed 1 year ago

vladyslavKucheruk commented 1 year ago

I have an intention to use getData function like this:

const customParams = undefined;
const { getData } = useVisitorData(customParams, { immediate: false });
...

const onSubmit = async () => {
  const response = await axios.get(...);
  await getData({ ignoreCache: true }, { linkedId: response.id, tag: { action: 'EXAMPLE_ACTION' } })
}

I cannot do that as getData doesn't take extra arguments. Which means I have to define custom arguments statically, when I initialize useVisitorData hook.

Could you please correct me if I am wrong with the usage or provide the solution for this specific case. Thank you!

ilfa commented 1 year ago

Hi @vladyslavKucheruk, Thank you for the issue. I agree with you, it makes sense! I'll provide a solution for your case soon.

ilfa commented 1 year ago

:tada: This issue has been resolved in version 2.4.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

ilfa commented 1 year ago

@vladyslavKucheruk you can try v2.4.0.

Just pass options to the getData function like:

const onSubmit = async () => {
  const response = await axios.get(...);
  await getData({ ignoreCache: true, linkedId: response.id, tag: { action: 'EXAMPLE_ACTION' } })
}
vladyslavKucheruk commented 1 year ago

Thank you so much, I appreciate your support. Now it looks more similar to js and RN packages!