|
|
@ -5,7 +5,7 @@ import fetch from 'node-fetch'; |
|
|
|
import { stringify as stringifyQuery } from 'querystring'; |
|
|
|
import chalk from 'chalk'; |
|
|
|
|
|
|
|
const URL = 'https://api.now.sh/registration'; |
|
|
|
const URL = 'http://api-registration.now.sh'; |
|
|
|
|
|
|
|
const stdin = process.openStdin(); |
|
|
|
|
|
|
@ -23,6 +23,10 @@ async function getVerificationToken (email) { |
|
|
|
const data = JSON.stringify({ email }); |
|
|
|
const res = await fetch(URL, { |
|
|
|
method: 'POST', |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json', |
|
|
|
'Content-Length': Buffer.byteLength(data) |
|
|
|
}, |
|
|
|
body: data |
|
|
|
}); |
|
|
|
|
|
|
@ -72,8 +76,7 @@ async function register () { |
|
|
|
return { email, token: final }; |
|
|
|
} |
|
|
|
|
|
|
|
export default function () { |
|
|
|
return register().then((loginData) => { |
|
|
|
export default async function () { |
|
|
|
const loginData = await register(); |
|
|
|
return fs.writeFile(pathJoin(homedir(), '.now.json'), JSON.stringify(loginData)); |
|
|
|
}); |
|
|
|
} |
|
|
|