-
Notifications
You must be signed in to change notification settings - Fork 0
/
store.js
61 lines (59 loc) · 1.18 KB
/
store.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const inquirer = require('inquirer');
const customer = require('./functions/bamazonCustomer');
const manager = require('./functions/bamazonManager');
const supervisor = require('./functions/bamazonSupervisor');
function enterStore() {
inquirer.prompt([
{
type: 'list',
name: 'role',
message: 'Name your role',
choices: [
"Customer",
"Manager",
"Supervisor",
]
}
]).then((answers) => {
switch (answers.role) {
case "Customer":
customer.askCustomer();
break;
case "Manager":
inquirer.prompt([
{
type: 'password',
name: 'password',
message: 'Password'
}
]).then((answers) => {
if (answers.password === "password") {
manager.askManager();
} else {
console.log('Wrong Password!')
process.exit();
}
})
break;
case "Supervisor":
inquirer.prompt([
{
type: 'password',
name: 'password',
message: 'Password'
}
]).then((answers) => {
if (answers.password === "password") {
supervisor.askSupervisor();
} else {
console.log('Wrong Password!')
process.exit();
}
})
break;
default:
break;
}
})
}
enterStore();