Backend-Adresse aus .env file beziehen

This commit is contained in:
Torsten Schulz
2024-06-15 23:29:41 +02:00
parent 61653ff407
commit 4e371f88b1
23 changed files with 568 additions and 83 deletions

View File

@@ -93,9 +93,9 @@ export default {
positionIds: positionIds
};
if (this.localContactPerson.id) {
await axios.put(`http://localhost:3000/api/contact-persons/${this.localContactPerson.id}`, payload);
await axios.put(`/contact-persons/${this.localContactPerson.id}`, payload);
} else {
await axios.post('http://localhost:3000/api/contact-persons', payload);
await axios.post('/contact-persons', payload);
}
this.$emit('contactPersonSaved');

View File

@@ -175,7 +175,7 @@ export default {
},
async created() {
try {
const eventTypeResponse = await axios.get('http://localhost:3000/api/event-types');
const eventTypeResponse = await axios.get('/event-types');
this.eventTypes = eventTypeResponse.data;
this.selectedEventType = this.eventTypes.find(type => type.id === this.event.eventTypeId) || null;
} catch (error) {
@@ -196,9 +196,9 @@ export default {
payload.dayOfWeek = payload.dayOfWeek.value;
let response;
if (this.eventData.id) {
response = await axios.put(`http://localhost:3000/api/events/${this.eventData.id}`, payload);
response = await axios.put(`/events/${this.eventData.id}`, payload);
} else {
response = await axios.post('http://localhost:3000/api/events', payload);
response = await axios.post('/events', payload);
}
this.$emit('saved', response.data);
} catch (error) {

View File

@@ -89,9 +89,9 @@
async saveInstitution() {
try {
if (this.localInstitution.id) {
await axios.put(`http://localhost:3000/api/institutions/${this.localInstitution.id}`, this.localInstitution);
await axios.put(`/institutions/${this.localInstitution.id}`, this.localInstitution);
} else {
await axios.post('http://localhost:3000/api/institutions', this.localInstitution);
await axios.post('/institutions', this.localInstitution);
}
this.$emit('saved');
this.$emit('cancelled');

View File

@@ -39,10 +39,8 @@ export default {
watch: {
value(newVal) {
this.selectedPositions = newVal;
console.log('PositionSelect - value watch - newVal:', newVal);
},
selectedPositions(newVal) {
console.log('PositionSelect - selectedPositions watch - newVal:', newVal);
this.$emit('input', newVal);
}
},
@@ -52,8 +50,7 @@ export default {
methods: {
async fetchPositions() {
try {
const response = await axios.get('http://localhost:3000/api/positions');
console.log('PositionSelect - fetchPositions - response.data:', response.data);
const response = await axios.get('/positions');
this.$emit('update:options', response.data);
} catch (error) {
console.error('Fehler beim Abrufen der Positionen:', error);