Backend-Adresse aus .env file beziehen
This commit is contained in:
@@ -43,25 +43,25 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async fetchPositions() {
|
||||
const response = await axios.get('http://localhost:3000/api/positions');
|
||||
const response = await axios.get('/positions');
|
||||
this.positions = response.data;
|
||||
},
|
||||
async addPosition() {
|
||||
if (this.editMode) {
|
||||
await axios.put(`http://localhost:3000/api/positions/${this.editId}`, this.newPosition);
|
||||
await axios.put(`/positions/${this.editId}`, this.newPosition);
|
||||
} else {
|
||||
const response = await axios.post('http://localhost:3000/api/positions', this.newPosition);
|
||||
const response = await axios.post('/positions', this.newPosition);
|
||||
this.positions.push(response.data);
|
||||
}
|
||||
this.resetForm();
|
||||
await this.fetchPositions();
|
||||
},
|
||||
async updatePosition(position) {
|
||||
await axios.put(`http://localhost:3000/api/positions/${position.id}`, position);
|
||||
await axios.put(`/positions/${position.id}`, position);
|
||||
this.fetchPositions(); // Refresh the list
|
||||
},
|
||||
async deletePosition(id) {
|
||||
await axios.delete(`http://localhost:3000/api/positions/${id}`);
|
||||
await axios.delete(`/positions/${id}`);
|
||||
this.fetchPositions(); // Refresh the list
|
||||
},
|
||||
editPosition(position) {
|
||||
|
||||
Reference in New Issue
Block a user