Last active
August 13, 2021 16:30
-
-
Save ACoolmanBigHealth/ea0078f703804988f020f504850cceeb to your computer and use it in GitHub Desktop.
getPrevAnswers.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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