make login async, add ids to customer records

This commit is contained in:
2017-02-20 14:51:58 -07:00
parent 6a741b0dd6
commit 3540920d2d
2 changed files with 16 additions and 8 deletions

View File

@@ -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 }) {

View File

@@ -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);
});
},
},