so i have a fucntion which would return a Value for example :
let value= function () =>{
//basically getting values from an api
let get = axios.get("example.com").then(res=>{
Value = res
})
// Value is the value that had been retrieved from a Get request from an API
return Value ;
}
module.export = {value}
^^ That is the first file in the secound file i want to get the values of use the them , the problem here that in the first time i use the function :
const first_file = require("./first_file")
first_file.then(res=>{
console.log(res)
})
the first time i use the fucntion very thing would be fine but sometimes in case of an error i would call the function again using try catch method , this would return the same response i got first time
Sorry For the bad explanation