From 3540920d2dff8166ba67c9336da708c4dd8d3913 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Mon, 20 Feb 2017 14:51:58 -0700 Subject: [PATCH] make login async, add ids to customer records --- src/store/authentication.js | 16 +++++++++------- src/store/customers.js | 8 +++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/store/authentication.js b/src/store/authentication.js index e56056e..3a5bc28 100644 --- a/src/store/authentication.js +++ b/src/store/authentication.js @@ -16,13 +16,15 @@ export default { // TODO: login via the server return new Promise((resolve, reject) => { - if (!email || !password) { - commit('resetUser'); - reject(); - } else { - commit('setUser', email); - resolve(); - } + setTimeout(() => { + if (!email || !password) { + commit('resetUser'); + reject(); + } else { + commit('setUser', email); + resolve(); + } + }, 300); }); }, userLogout({ commit }) { diff --git a/src/store/customers.js b/src/store/customers.js index 2f6e978..21b7ac5 100644 --- a/src/store/customers.js +++ b/src/store/customers.js @@ -25,36 +25,42 @@ export default { return new Promise((resolve) => { const customers = [{ + id: 'ai7rgail73ria3uhr', firstname: 'Peter', lastname: 'Amaya', email: 'PeterPAmaya@teleworm.us', city: 'Greensboro', state: 'NC', }, { + id: '7a4toi7g4ot8jaefg', firstname: 'Derrick', lastname: 'Duplantis', email: 'DerrickCDuplantis@dayrep.com', city: 'Freeport', state: 'NY', }, { + id: 'q93r7ga4otilsghae', firstname: 'Andrea', lastname: 'Hernandez', email: 'AndreaRHernandez@armyspy.com', city: 'Maumee', state: 'OH', }, { + id: 'ia73groi7ah4oitgn', firstname: 'Daniel', lastname: 'Hurt', email: 'DanielGHurt@teleworm.us', city: 'Cedar Rapids', state: 'IA', }, { + id: '98hi3kubtksgli9rg', firstname: 'Milagros', lastname: 'Anderson', email: 'MilagrosCAnderson@jourrapide.com', city: 'Kansas City', state: 'KS', }, { + id: 'pl74p39otujs5kuhz', firstname: 'An', lastname: 'K\'ung', email: 'AnKung@dayrep.com', @@ -67,7 +73,7 @@ export default { commit('setCustomers', results); commit('toggleLoading'); resolve(); - }, 2000) + }, 300); }); }, },