re-setup subproject kontor-vue

This commit is contained in:
2026-04-05 13:27:00 +02:00
parent b81a38e650
commit 781f6dd854
78 changed files with 1833 additions and 9304 deletions
+9
View File
@@ -0,0 +1,9 @@
export default function authHeader() {
let user = JSON.parse(localStorage.getItem("user"));
if (user && user.accessToken) {
return { Authorization: "Bearer " + user.accessToken };
} else {
return {};
}
}
+33
View File
@@ -0,0 +1,33 @@
import axios from "axios";
const API_URL = "http://localhost:8200/";
class AuthService {
login(user) {
return axios
.post(API_URL + "login", {
email: user.username,
password: user.password,
})
.then((response) => {
if (response.data.accessToken) {
localStorage.setItem("user", JSON.stringify(response.data));
}
return response.data;
});
}
logout() {
localStorage.removeItem("user");
}
register(user) {
return axios.post(API_URL + "signup", {
username: user.username,
email: user.email,
password: user.password,
});
}
}
export default new AuthService();
+24
View File
@@ -0,0 +1,24 @@
import axios from "axios";
import authHeader from "./auth-header";
const API_URL = "http://localhost:8200/health/";
class UserService {
getPublicContent() {
return axios.get(API_URL + "all");
}
getUserBoard() {
return axios.get(API_URL + "user", { headers: authHeader() });
}
getModeratorBoard() {
return axios.get(API_URL + "mod", { headers: authHeader() });
}
getAdminBoard() {
return axios.get(API_URL + "admin", { headers: authHeader() });
}
}
export default new UserService();