-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.js
36 lines (29 loc) · 912 Bytes
/
api.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
export const login= async (username, password) =>{
const response= await fetch('https://reqres.in/api/login',{
method: 'POST',
headers: {'content-type': 'application/json'},
body: JSON.stringify({username, password}),
})
if(response.ok){
const {token}= await response.json()
return token
}
const erroMesage= await response.text()
throw new Error(erroMesage)
}
// export const signuo=async (username, password, registreCommerN) =>{
// const response= await fetch('https://reqres.in/api/login',{
// method: 'POST',
// headers: {'content-type': 'application/json'},
// body: JSON.stringify({username, password}),
// })
// if(response.ok){
// const {token}= await response.json()
// return token
// }
// const erroMesage= await response.text()
// throw new Error(erroMesage)
// }
export const addPlate=(plate)=>{
//
}