Ajax issues not rendering a component
chabgood opened this issue · comments
I have an ajax call that calls a method to go get some data, but it does not re render the component.
In the store I have a fetch method that works, fetchApiRequests.
I have this const defined to send it out:
const getApiRequests = () => fetchApiRequests();
In the component:
const { currentUser, getApiRequests } = useGlobalHook('Store');
axios.post('/api_requests', user)
.then(
() => {
success(`Api Request - ${apiName} - was added`);
setApiName('')
getApiRequests
}
)
.catch((theError) => {
error(`Api Request Failed: ${theError.message}`);
});
This does go get the data but the component does not re render:
@chabgood Did you close the issue because you have been able to fix it? I am sorry for replying late.
No i fixed it thanks.
@chabgood Great 🎉🎉🎉