Is there a way to detect when I am in dev mode within my javascript files. The reason being is that I am using wp-api-request to get a REST posts collection and I get a console error.
My dev server is :
http://localhost:3000/wp-json/wp/v2/posts
and production server is:
http://localhost:8000/wp-json/wp/v2/posts
When I make the request in dev mode I get a console error,
http://localhost:8000/wp-json/wp/v2/posts 403 (Forbidden)
This is confirmed when I print out wpApiSettings.root. It shows as,
wpApiSettings.root = 'http://localhost:8000/wp-json/
Is there a config variable I can access to detect when I am using the dev server so that I can change wpApiSettings.root to the dev sever?