Fix template literals in multiple Vue components for API URL construction to ensure correct endpoint formatting.

This commit is contained in:
Torsten Schulz (local)
2025-10-20 08:47:05 +02:00
parent 2e3a1a9e99
commit 52712db78d
10 changed files with 22 additions and 20 deletions

View File

@@ -214,7 +214,7 @@ const form = ref({
// Lade alle Bundesländer // Lade alle Bundesländer
async function loadStates() { async function loadStates() {
try { try {
const response = await fetch('${API_URL}/holidays/states', { const response = await fetch(`${API_URL}/holidays/states`, {
headers: { headers: {
'Authorization': `Bearer ${authStore.token}` 'Authorization': `Bearer ${authStore.token}`
} }
@@ -235,7 +235,7 @@ async function loadStates() {
async function loadHolidays() { async function loadHolidays() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/holidays', { const response = await fetch(`${API_URL}/holidays`, {
headers: { headers: {
'Authorization': `Bearer ${authStore.token}` 'Authorization': `Bearer ${authStore.token}`
} }
@@ -278,7 +278,7 @@ async function createHoliday() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/holidays', { const response = await fetch(`${API_URL}/holidays`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -93,7 +93,7 @@ const form = ref({
// Lade alle Einladungen // Lade alle Einladungen
async function loadInvitations() { async function loadInvitations() {
try { try {
const response = await fetch('${API_URL}/invite', { const response = await fetch(`${API_URL}/invite`, {
headers: { headers: {
'Authorization': `Bearer ${authStore.token}` 'Authorization': `Bearer ${authStore.token}`
} }
@@ -118,7 +118,7 @@ async function sendInvite() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/invite', { const response = await fetch(`${API_URL}/invite`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -114,7 +114,9 @@
import { ref } from 'vue' import { ref } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { useAuthStore } from '../stores/authStore' import { useAuthStore } from '../stores/authStore'
import { API_BASE_URL } from '@/config/api'
const API_URL = API_BASE_URL
const router = useRouter() const router = useRouter()
const authStore = useAuthStore() const authStore = useAuthStore()
@@ -158,7 +160,7 @@ const handleLogin = async () => {
const handleGoogleLogin = () => { const handleGoogleLogin = () => {
// Redirect zu Google OAuth // Redirect zu Google OAuth
window.location.href = '${API_URL}/auth/google' window.location.href = `${API_URL}/auth/google`
} }
</script> </script>

View File

@@ -94,7 +94,7 @@ async function changePassword() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/password', { const response = await fetch(`${API_URL}/password`, {
method: 'PUT', method: 'PUT',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -104,7 +104,7 @@ const form = ref({
// Lade alle Watcher // Lade alle Watcher
async function loadWatchers() { async function loadWatchers() {
try { try {
const response = await fetch('${API_URL}/watcher', { const response = await fetch(`${API_URL}/watcher`, {
headers: { headers: {
'Authorization': `Bearer ${authStore.token}` 'Authorization': `Bearer ${authStore.token}`
} }
@@ -130,7 +130,7 @@ async function addWatcher() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/watcher', { const response = await fetch(`${API_URL}/watcher`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -137,7 +137,7 @@ const form = ref({
async function loadProfile() { async function loadProfile() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/profile', { const response = await fetch(`${API_URL}/profile`, {
headers: { headers: {
'Authorization': `Bearer ${authStore.token}` 'Authorization': `Bearer ${authStore.token}`
} }
@@ -167,7 +167,7 @@ async function loadProfile() {
// Lade Bundesländer // Lade Bundesländer
async function loadStates() { async function loadStates() {
try { try {
const response = await fetch('${API_URL}/profile/states', { const response = await fetch(`${API_URL}/profile/states`, {
headers: { headers: {
'Authorization': `Bearer ${authStore.token}` 'Authorization': `Bearer ${authStore.token}`
} }
@@ -187,7 +187,7 @@ async function loadStates() {
async function saveProfile() { async function saveProfile() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/profile', { const response = await fetch(`${API_URL}/profile`, {
method: 'PUT', method: 'PUT',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -84,7 +84,7 @@ const { showModal, modalConfig, alert, confirm, onConfirm, onCancel } = useModal
async function loadUsers() { async function loadUsers() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/roles/users', { const response = await fetch(`${API_URL}/roles/users`, {
headers: { headers: {
'Authorization': `Bearer ${authStore.token}` 'Authorization': `Bearer ${authStore.token}`
} }

View File

@@ -125,7 +125,7 @@ const form = ref({
async function loadSickEntries() { async function loadSickEntries() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/sick', { const response = await fetch(`${API_URL}/sick`, {
headers: { headers: {
'Authorization': `Bearer ${authStore.token}` 'Authorization': `Bearer ${authStore.token}`
} }
@@ -147,7 +147,7 @@ async function loadSickEntries() {
// Lade alle Krankheitstypen // Lade alle Krankheitstypen
async function loadSickTypes() { async function loadSickTypes() {
try { try {
const response = await fetch('${API_URL}/sick/types', { const response = await fetch(`${API_URL}/sick/types`, {
headers: { headers: {
'Authorization': `Bearer ${authStore.token}` 'Authorization': `Bearer ${authStore.token}`
} }
@@ -173,7 +173,7 @@ async function createSick() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/sick', { const response = await fetch(`${API_URL}/sick`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -179,7 +179,7 @@ function onWishtypeChange() {
async function loadTimewishes() { async function loadTimewishes() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/timewish', { const response = await fetch(`${API_URL}/timewish`, {
headers: { headers: {
'Authorization': `Bearer ${authStore.token}` 'Authorization': `Bearer ${authStore.token}`
} }
@@ -207,7 +207,7 @@ async function createTimewish() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/timewish', { const response = await fetch(`${API_URL}/timewish`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -137,7 +137,7 @@ function onStartDateChange() {
async function loadVacations() { async function loadVacations() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/vacation', { const response = await fetch(`${API_URL}/vacation`, {
headers: authStore.getAuthHeaders() headers: authStore.getAuthHeaders()
}) })
@@ -161,7 +161,7 @@ async function createVacation() {
try { try {
loading.value = true loading.value = true
const response = await fetch('${API_URL}/vacation', { const response = await fetch(`${API_URL}/vacation`, {
method: 'POST', method: 'POST',
headers: { headers: {
...authStore.getAuthHeaders(), ...authStore.getAuthHeaders(),