import axios from 'axios';
axios.defaults.baseURL = process.env.REACT_APP_API_URL;

export const refreshToken = async () => {
    return undefined;
}

export const login = async (username, password) => {
    return undefined;
}

export const logout = async (bearerToken) => {
    try {
        const {request} = await axios.post(
            '/users/revoke-token',
            {},
            {
                headers: {
                    "Authorization": "Bearer " + bearerToken
                },
                withCredentials: true
            })

        if (request.status === 200) {
            return true;
        }

    } catch (error) {
        console.log("An error occurred while trying to log out.");
        return false;
    }
    return false;
}

