Closed olivierobert closed 2 years ago
The api utils were definitely written for creating abstraction for all api call. However, for some strange reason, using this method through useAuth
and useKeyword
hooks were issuing CORS problems. Hence to get things done, I've written more code in the hooks. But I'll work on it and see I can make this abstraction work across ssr and browser call.
utils/api.js
seems like a good idea to abstract away the implementation of how API requests are made. It also allows using the configNEXT_PUBLIC_SERVER_HOST
in only one place. Rightfully, this util was used in the main app file:https://github.com/rashikzaman/scrapper-react/blob/ebc3a8fa3d1c7b06269bc16158409bea5e99d44b/pages/_app.js?_pjax=%23js-repo-pjax-container%2C%20div%5Bitemtype%3D%22http%3A%2F%2Fschema.org%2FSoftwareSourceCode%22%5D%20main%2C%20%5Bdata-pjax-container%5D#L15
However, the hooks
useAuth
anduseKeyword
do not make use of it. Is there a reason for this? Do you see value in making it more consistent?