adding an api on admin page redirects to homepage when submit is clicked