Closed nelsontr closed 1 year ago
We should have a specific file with all API calls we do, to maintain the code readability and maintainability.
Example: From
fetch(`/api/members/${userData.username}`) .then((res) => res.json()) .then((fetchMember) => { setMember(fetchMember); setIsLoaded(true); }, (err) => { setIsLoaded(true); setError(err); }, );
To
APIService.fetchMember(username) .then(fetchMember) => { setMember(fetchMember); setIsLoaded(true); }, (err) => { setIsLoaded(true); setError(err); }, );
We should have a specific file with all API calls we do, to maintain the code readability and maintainability.
Example: From
To