Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

user.js 868B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { API_ENDPOINT } from "./endpointDef";
  2. export const loginApi = async (payload) => {
  3. const result = await fetch(API_ENDPOINT + 'api/auth/local', {
  4. method: 'POST',
  5. headers: {
  6. 'Content-Type': 'application/json'
  7. },
  8. body: JSON.stringify(payload)
  9. })
  10. const res = await result.json();
  11. return res;
  12. };
  13. export const registerApi = async (payload) => {
  14. const result = await fetch(API_ENDPOINT + 'api/auth/local/register', {
  15. method: 'POST',
  16. headers: {
  17. 'Content-Type': 'application/json'
  18. },
  19. body: JSON.stringify(payload)
  20. })
  21. const res = await result.json();
  22. return res;
  23. };
  24. export const googleApi = async (accessToken) => {
  25. const result = await fetch('https://9dae-178-220-74-194.eu.ngrok.io/' + `api/auth/google/callback?access_token=${accessToken}`);
  26. const res = await result.json();
  27. return res;
  28. };