Skip to content

selectFrontstoreApiUrl$(): Observable<string>

The selectFrontstoreApiUrl$ method allows you to get an observable with the base url to the frontstore API.

Returned value

A returned value has a type of Observable<string>.

Example

In this example we make a StorefrontSettingsApi call to get an observable with the base url to the frontstore API.

    useStorefront(async (storefront) => {
        const storefrontSettingsApi = storefront.getApiSync('StorefrontSettingsApi');

        const frontstoreApiUrl$ = storefrontSettingsApi.selectFrontstoreApiUrl$();

        frontstoreApiUrl$.subscribe((frontstoreApiUrl) => {
            console.log('the base API url:', frontstoreApiUrl);
        });
    });

Storefront Settings API methods reference