You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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. };