mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-20 23:13:58 +00:00
1.1.0
This commit is contained in:
20
src/util/Account.ts
Normal file
20
src/util/Account.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import * as fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
export async function loadAccounts() {
|
||||
try {
|
||||
let file = 'accounts.json'
|
||||
|
||||
// If dev mode, use dev account(s)
|
||||
if (process.argv.includes('-dev')) {
|
||||
file = 'accounts.dev.json'
|
||||
}
|
||||
|
||||
const accountDir = path.join(__dirname, '../', file)
|
||||
const accounts = fs.readFileSync(accountDir, 'utf-8')
|
||||
|
||||
return JSON.parse(accounts)
|
||||
} catch (error) {
|
||||
throw new Error(error as string)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user