Move api calls into services
This commit is contained in:
33
src/services/auth.js
Normal file
33
src/services/auth.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const AUTH_URL = 'https://dev-auth.fiskerdps.com';
|
||||
|
||||
export default {
|
||||
signIn: (username, password) => fetch(`${AUTH_URL}/auth/login`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username,
|
||||
password,
|
||||
})
|
||||
}).then((response) => response.json()),
|
||||
|
||||
signUp: (username, password) => fetch(`${AUTH_URL}/auth/register`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username,
|
||||
password,
|
||||
})
|
||||
}).then((response) => response.json()),
|
||||
|
||||
verify: (jwt) => fetch(`${AUTH_URL}/auth/verify`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({ token: jwt })
|
||||
}).then((response) => response.json()),
|
||||
}
|
||||
Reference in New Issue
Block a user