Add initial Code
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: '/api',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
withCredentials: true, // Wichtig für Session-Cookies!
|
||||
});
|
||||
|
||||
// Sanctum-Token aus localStorage hinzufügen (falls vorhanden)
|
||||
const token = localStorage.getItem('sanctum_token');
|
||||
if (token) {
|
||||
api.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
export default api;
|
||||
Reference in New Issue
Block a user