diff --git a/lib/login.js b/lib/login.js index 3ea199a..47e0631 100644 --- a/lib/login.js +++ b/lib/login.js @@ -5,6 +5,8 @@ import fetch from 'node-fetch'; import { stringify as stringifyQuery } from 'querystring'; import chalk from 'chalk'; +const URL = 'https://api.now.sh/registration'; + const stdin = process.openStdin(); function readEmail () { @@ -19,13 +21,8 @@ function readEmail () { async function getVerificationToken (email) { const data = JSON.stringify({ email }); - const res = await fetch('http://localhost:3001/', { + const res = await fetch(URL, { method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json', - 'Content-Length': data.length - }, body: data }); @@ -43,8 +40,7 @@ async function verify (email, verificationToken) { token: verificationToken }; - const res = await fetch('http://localhost:3001/verify?' + stringifyQuery(query)); - + const res = await fetch(`${URL}/verify?${stringifyQuery(query)}`); const body = await res.json(); return body.token; }