Open geeorgipehlianov1 opened 1 year ago
@geeorgipehlianov1 this is because the Omise script is still loading, during which time you won't have access to functions such as createTokenPromise
. If you also console log the loading
variable returned from useOmise
, you should see that it's true
whilst createTokenPromise
is null
.
Usually this won't be a problem though, because you should only need createTokenPromise
once there has been some user interaction e.g. entering credit card details, by which time the script should have loaded.
@cpvdeveloper I see that the script is still loading I have also logged the loading variable but the loading stays true and noting is changed until I make some change on the component or refresh the page. I have build an app where the user is interacting and the problem is still the same. Interesting thing is that it worked few days ago and when I tried it on Friday the problem showed up. Because of the typescript I should add a check if(createTokenPromise) -> then do the needed logic and since the createTokenPromise remain null all the time the logic about creating a charge token is skipped.
Hello, when I try to destructure the result from useOmise hook and get the createTokenPromise function the result is null the first time, after I refresh the page few times(not specific times, sometimes 1 time, sometime 2-3-4) I get the needed result(which is the function).