mirror of
https://github.com/robonen/metr.git
synced 2026-03-20 02:44:42 +00:00
Changes by Robonen
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
import { createApp } from 'vue'
|
// Core
|
||||||
import App from './App.vue'
|
import { createApp } from 'vue';
|
||||||
import router from './router'
|
import router from './router';
|
||||||
|
import store from './store';
|
||||||
|
|
||||||
const app = createApp(App)
|
import App from './App.vue';
|
||||||
|
|
||||||
app.use(router)
|
const app = createApp(App);
|
||||||
|
|
||||||
app.mount('#app')
|
app.use(router).use(store).mount('#app');
|
||||||
|
|||||||
6
frontend/src/services/api.js
Normal file
6
frontend/src/services/api.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
export default axios.create({
|
||||||
|
baseURL: 'http://tusur.tk:9080/api',
|
||||||
|
withCredentials: true,
|
||||||
|
});
|
||||||
27
frontend/src/services/auth.js
Normal file
27
frontend/src/services/auth.js
Normal 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;
|
||||||
Reference in New Issue
Block a user