i am trying to post axios call so that i can create github repository but unable to do so

Viewed 16

i use axios call and pass my header token with it but giving error of not found but i tried that same request by postman and it working on that

import axios from "axios";

let githubToken="impassingmytokenhere";
let apiUrl="https://api.github.com/users/repo";


const authAxios = axios.create({
    baseURL:apiUrl,
    headers:{
        Authorization:`Bearer ${githubToken}`
        }
})

const xapi= async()=>{
    await authAxios.post(apiUrl,{
    "name":"test2-api",
    "description":"This is a repo from an API key"
})
    .then((response)=>console.log(response))
    .catch((err)=>console.log(err));
}

xapi();
0 Answers
Related