{"size": 518, "ext": "js", "max_stars_repo_path": "pages/api/apiInstance.js", "max_stars_repo_name": "miyurugunarathna/todo-frontend", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "pages/api/apiInstance.js", "max_issues_repo_name": "miyurugunarathna/todo-frontend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "pages/api/apiInstance.js", "max_forks_repo_name": "miyurugunarathna/todo-frontend", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.5833333333, "max_line_length": 69, "alphanum_fraction": 0.6351351351}
import axios from "axios";

    const url = process.env.NEXT_PUBLIC_BASE_URL;

const apiInstance = axios.create({
    baseURL: url,
});

// confire axios instance
apiInstance.interceptors.request.use(
    async function (config) {
        config.baseURL = url;
        config.headers = {
            Authorization: "Bearer " + localStorage.getItem("token"),
        };
        return config;
    },
    function (error) {
        return Promise.reject(error);
    }
);

//export apiInstance
export default apiInstance;