mirror of
https://github.com/robonen/metr.git
synced 2026-03-20 02:44:42 +00:00
28 lines
698 B
JavaScript
28 lines
698 B
JavaScript
import api from "@/services/api";
|
|
|
|
export const AuthService = {
|
|
async registration(email, password) {
|
|
const resp = await api.post('/auth/registration', {
|
|
email,
|
|
password,
|
|
});
|
|
localStorage.setItem('auth', JSON.stringify(resp));
|
|
return resp;
|
|
},
|
|
async login(email, password) {
|
|
const resp = await api.post('/auth/login', {
|
|
email,
|
|
password,
|
|
});
|
|
localStorage.setItem('auth', JSON.stringify(resp));
|
|
return resp;
|
|
},
|
|
async logout() {
|
|
await api.post('/auth/logout');
|
|
localStorage.removeItem('auth');
|
|
return true;
|
|
},
|
|
};
|
|
|
|
export default AuthService;
|