Fixed missing path and await.

This commit is contained in:
2023-05-19 19:45:08 +02:00
parent b85b84f4b9
commit 331b110eb8
2 changed files with 3 additions and 3 deletions

View File

@@ -5,11 +5,11 @@ const { createDriver } = require('./modules/driverManager');
const { createAccount } = require('./modules/microsoftHandler');
async function main() {
const numAccounts = 3;
const numAccounts = 1;
await connect();
const accountPromises = [];
for (let i = 0; i < numAccounts; i++) {
const promise = createAccount(createDriver());
const promise = await createAccount(createDriver());
accountPromises.push(promise);
console.log(`Account ${i + 1} done!`);
await new Promise((resolve) => setTimeout(resolve, 20000));

View File

@@ -102,7 +102,7 @@ async function createAccount(driver) {
let accounts = [];
if (fs.existsSync(path.join(__dirname, '../accounts/accounts.json'))) {
const content = fs.readFileSync('accounts.json', 'utf8');
const content = fs.readFileSync(path.join(__dirname, '../accounts/accounts.json'), 'utf8');
accounts = JSON.parse(content);
}