import { API_ENDPOINT } from "./endpointDef"; import apiEndpoints from "./apiEndpoints"; export const loginApi = async (payload) => { const result = await fetch(`${API_ENDPOINT}${apiEndpoints.login}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }) const res = await result.json(); return res; }; export const registerApi = async (payload) => { const result = await fetch(API_ENDPOINT + 'api/auth/local/register', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }) const res = await result.json(); return res; }; export const googleApi = async (accessToken) => { const result = await fetch('http://localhost:1337/' + `api/auth/google/callback?access_token=${accessToken}`); const res = await result.json(); return res; };