import httpClient from '@/common/http-client';
import axios from 'axios';
import { consts } from '@/common/config';

const login = (params) => {    
    return httpClient.post('/api/v1/bo/login/login', params, { headers: {"show-layer": "Yes"} },{ withCredentials: false });
};

const authNum = (params) => {
    return httpClient.post('/api/v1/bo/login/authNum', params);
};

const confirmNum = (params) => {
    //return httpClient.get('/api/public/auth/chknum', { params: params });
    return httpClient.post('/api/v1/bo/login/confirmNum', params);
};

const resetPassword = (params) => {
    return httpClient.post('/api/v1/bo/login/resetPassword', params);
};

const updatePassword = (params) => {
    return httpClient.post('/api/v1/bo/login/updatePassword', params);
};

const logout = () => {
    //return httpClient.get('/api/auth/logout', {headers: {"show-layer": "Yes"}});
    return httpClient.post('/api/v1/bo/login/logout', {headers: {"show-layer": "Yes"}});
};

const loginCheck = (params) => {    
    return httpClient.post('/api/v1/bo/login/loginCheck', params, { headers: {"show-layer": "Yes"} },{ withCredentials: false });
};

const setToken = (token) => {
    consts.authToken = token;
}

const getToken = () => {
    return consts.authToken;
}

export default {
    login,
    logout,
    confirmNum,
    authNum,
    resetPassword,
    updatePassword,
    loginCheck,
    setToken,
    getToken
};