From bcc4e854c92370234fcb2bebc29548c9c85a79df Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Mon, 30 Apr 2018 00:38:41 -0400 Subject: [PATCH] Add a loggedIn boolean to the api object Signed-off-by: Mcat12 --- src/utils.js | 1 + src/views/Login.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/utils.js b/src/utils.js index 2296cca..26358de 100644 --- a/src/utils.js +++ b/src/utils.js @@ -67,6 +67,7 @@ export const ignoreCancel = err => { }; export const api = { + loggedIn: false, authenticate(key) { return fetch(api.urlFor("auth"), { headers: new Headers({ "X-Pi-hole-Authenticate": key }), diff --git a/src/views/Login.js b/src/views/Login.js index fe8b5c5..467f946 100644 --- a/src/views/Login.js +++ b/src/views/Login.js @@ -37,6 +37,7 @@ export default class Login extends Component { // Assume it's ok since there was no error // TODO: verify response // TODO: transition to logged in mode + api.loggedIn = true; console.log("Logged In"); }) .catch(() => this.setState({ error: true }));