const login = async (credentials) => { const request = { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(credentials), } const response = await fetch('http://localhost:5005/admin/auth/login', request) const data = await response.json(); localStorage.setItem('token', data.token); return data } const logout = async (email) => { const token = localStorage.getItem('token'); const request = { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}`, }, } await fetch('http://localhost:5005/admin/auth/logout?email=' + email, request) } export default { login, logout }