Extract API to src/api.js