17 lines
610 B
TypeScript
17 lines
610 B
TypeScript
(async () => {
|
|
const res = await fetch('http://localhost:3333/api/auth/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ email: 'admin@gastrobar.com', senha: '123456' }),
|
|
});
|
|
const data = await res.json();
|
|
console.log('TOKEN:', data.token);
|
|
|
|
const res2 = await fetch('http://localhost:3333/api/comandas?status=ABERTA,FECHADA', {
|
|
headers: { Authorization: `Bearer ${data.token}` },
|
|
});
|
|
const data2 = await res2.json();
|
|
console.log('COMANDAS STATUS:', res2.status);
|
|
console.log('COMANDAS:', JSON.stringify(data2, null, 2));
|
|
})();
|