Skip to content

Instantly share code, notes, and snippets.

@ACoolmanBigHealth
Last active August 13, 2021 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ACoolmanBigHealth/ea0078f703804988f020f504850cceeb to your computer and use it in GitHub Desktop.
Save ACoolmanBigHealth/ea0078f703804988f020f504850cceeb to your computer and use it in GitHub Desktop.
getPrevAnswers.js
export const getPrevAnswers = async () => {
const options = getDropdownValues();
const [bedtimeValue, asleepValue] = [
random(0, options.length),
random(0, options.length)
]
.map(index => +options[index].value)
.sort((a, b) => a - b)
.reverse()
.map(value => `${value}`);
return new Promise(resolve =>
setTimeout(() =>
resolve({
json: () => ({
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: { bedtimeValue, asleepValue },
})
}), 1000)
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment