Skip to main content
added 247 characters in body
Source Link
Jamiec
  • 136.5k
  • 15
  • 143
  • 202

You're making 2 mistakes

The code can be hugely simplified:

async function LoadBuildId(result) { let url = 'MySecondFancyUrl'; const response = await axios.get(url) result.buildId = response.data; return result; } 

and

async function LoadBasicData() { let url = 'MyFancyUrl'; let result = Object.create(null); const response = await axios.get(url); result = await LoadBuildId(result); return result; } 

To be honest, it can be simplified even further - theres no need to be constructing result objects just to set properties on it - you may as well just return the results from a call to axios.get

You're making 2 mistakes

The code can be hugely simplified:

async function LoadBuildId(result) { let url = 'MySecondFancyUrl'; const response = await axios.get(url) result.buildId = response.data; return result; } 

and

async function LoadBasicData() { let url = 'MyFancyUrl'; const response = await axios.get(url); result = await LoadBuildId(result); return result; } 

You're making 2 mistakes

The code can be hugely simplified:

async function LoadBuildId(result) { let url = 'MySecondFancyUrl'; const response = await axios.get(url) result.buildId = response.data; return result; } 

and

async function LoadBasicData() { let url = 'MyFancyUrl'; let result = Object.create(null); const response = await axios.get(url); result = await LoadBuildId(result); return result; } 

To be honest, it can be simplified even further - theres no need to be constructing result objects just to set properties on it - you may as well just return the results from a call to axios.get

Fixed a typo
Source Link
Andreas
  • 21.9k
  • 7
  • 52
  • 58

You're making 2 mistakes

The code can be hugely simplified:

async function LoadBuildId(result) { let url = 'MySecondFancyUrl'; const response = await axiosgetaxios.get(url) result.buildId = response.data; return result; } 

and

async function LoadBasicData() { let url = 'MyFancyUrl'; const response = await axios.get(url); result = await LoadBuildId(result); return result; } 

You're making 2 mistakes

The code can be hugely simplified:

async function LoadBuildId(result) { let url = 'MySecondFancyUrl'; const response = await axiosget(url) result.buildId = response.data; return result; } 

and

async function LoadBasicData() { let url = 'MyFancyUrl'; const response = await axios.get(url); result = await LoadBuildId(result); return result; } 

You're making 2 mistakes

The code can be hugely simplified:

async function LoadBuildId(result) { let url = 'MySecondFancyUrl'; const response = await axios.get(url) result.buildId = response.data; return result; } 

and

async function LoadBasicData() { let url = 'MyFancyUrl'; const response = await axios.get(url); result = await LoadBuildId(result); return result; } 
Source Link
Jamiec
  • 136.5k
  • 15
  • 143
  • 202

You're making 2 mistakes

The code can be hugely simplified:

async function LoadBuildId(result) { let url = 'MySecondFancyUrl'; const response = await axiosget(url) result.buildId = response.data; return result; } 

and

async function LoadBasicData() { let url = 'MyFancyUrl'; const response = await axios.get(url); result = await LoadBuildId(result); return result; }