Update api.js

frontend