All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- server/auth.js: JWT middleware and auth routes - src/stores/auth.js + useAuthFetch.js: client-side auth state - src/views/LoginView.vue + UsersView.vue: login and user management UI - router, sidebar, App.vue: guard routes behind auth - COOLIFY.md: add real deployment IDs
16 lines
411 B
JavaScript
16 lines
411 B
JavaScript
import { useAuthStore } from "../stores/auth";
|
|
|
|
export function useAuthFetch() {
|
|
function authFetch(url, options = {}) {
|
|
const auth = useAuthStore();
|
|
const headers = {
|
|
"Content-Type": "application/json",
|
|
...(options.headers || {}),
|
|
};
|
|
if (auth.token) headers["Authorization"] = `Bearer ${auth.token}`;
|
|
return fetch(url, { ...options, headers });
|
|
}
|
|
|
|
return { authFetch };
|
|
}
|