Skip to content

Instantly share code, notes, and snippets.

@kujo205
Created April 17, 2025 09:08
Show Gist options
  • Select an option

  • Save kujo205/aeda1b6e248f9c0dba6a8aa98f1bea51 to your computer and use it in GitHub Desktop.

Select an option

Save kujo205/aeda1b6e248f9c0dba6a8aa98f1bea51 to your computer and use it in GitHub Desktop.
api example frontend
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