1
0
mirror of https://github.com/robonen/metr.git synced 2026-03-20 10:54:41 +00:00

Changes by Robonen

This commit is contained in:
Konstantin Vinokurov
2022-05-29 20:30:07 +07:00
parent 140207d481
commit 1c4ba01ad8
3 changed files with 40 additions and 6 deletions

View File

@@ -0,0 +1,27 @@
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;