//import { authHeader } from './auth';
import { wrapRequest } from './nav';
const vueAppMagentoApiUrl=process.env.VUE_APP_MAGENTO_API_URL;

export const doLogin = wrapRequest((loginDetail) => {
    const requestOptions = {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'Access-Control-Allow-Origin': '*',
        },
        body: JSON.stringify({
            username: loginDetail.email,
            password: loginDetail.password
        })
    };
    return fetch(`${vueAppMagentoApiUrl}/rest/crn_retailer/V1/integration/customer/token`, requestOptions);
});

////////////////// dummy api //////////////////
/*export const doLogin = async(authentication) => {
    console.log('authentication:', authentication)
    let details = {
        "token": 'po8jyrv0l7t7g5pe7r9fppmy9wpl2anj',
        "response": "error",
    }
    return details;
};*/