Created
April 17, 2025 09:08
-
-
Save kujo205/aeda1b6e248f9c0dba6a8aa98f1bea51 to your computer and use it in GitHub Desktop.
api example frontend
This file contains hidden or 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
| const baseUrl = 'http://localhost:3000' | |
| class UsesAPI { | |
| async fecthUserByEmail(email, password) { | |
| // const r = await fetch(baseUrl + `/users?email=${email}&password=${}`, { | |
| // method: 'GET', | |
| // }) | |
| // const parsedR = await r.json() | |
| const parsedR = { | |
| email: '[email protected]', | |
| name: 'blah', | |
| age: 1000, | |
| } | |
| return parsedR | |
| } | |
| } | |
| export const userApi = new UsesAPI() | |
| /* | |
| * | |
| * function fetchUserData(form) { | |
| * const email = form.get('eamil') | |
| * | |
| * const data = userApi.fecthUserByEmail(email) | |
| * | |
| * } | |
| * | |
| * | |
| }fetchUserData() | |
| * | |
| <form onSubmit={}> | |
| </form> | |
| * | |
| * | |
| * */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment