-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: apply PR requested changes
- Loading branch information
Showing
8 changed files
with
1,859 additions
and
1,735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
import { API_HOST } from '../config/constants'; | ||
import { DEFAULT_GET, DEFAULT_POST } from './utils'; | ||
|
||
// payload = {email} | ||
export const signIn = async (payload) => { | ||
const req = await fetch(`${API_HOST}/login`, { | ||
method: 'POST', | ||
...DEFAULT_POST, | ||
body: JSON.stringify(payload), | ||
headers: { 'Content-Type': 'application/json' }, | ||
}); | ||
return req.status === 204; | ||
}; | ||
|
||
export const signOut = async () => { | ||
const req = await fetch(`${API_HOST}/logout`, { | ||
credentials: 'include', | ||
method: 'GET', | ||
}); | ||
const req = await fetch(`${API_HOST}/logout`, DEFAULT_GET); | ||
return req.status === 204; | ||
}; | ||
|
||
// payload = {name, mail} | ||
export const register = async (payload) => { | ||
export const signUp = async (payload) => { | ||
const req = await fetch(`${API_HOST}/register`, { | ||
method: 'POST', | ||
...DEFAULT_POST, | ||
body: JSON.stringify(payload), | ||
headers: { 'Content-Type': 'application/json' }, | ||
}); | ||
return req.status === 204; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const DEFAULT_GET = { | ||
credentials: 'include', | ||
method: 'GET', | ||
}; | ||
|
||
export const DEFAULT_POST = { | ||
method: 'POST', | ||
credentials: 'include', | ||
headers: { 'Content-Type': 'application/json' }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const SIGN_IN_PATH = '/signin'; | ||
export const REGISTER_PATH = '/register'; | ||
export const SIGN_IN_PATH = '/signIn'; | ||
export const SIGN_UP_PATH = '/signUp'; |
Oops, something went wrong.