This commit is contained in:
@ -2,7 +2,7 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<h1>Profil bearbeiten</h1>
|
||||
<form @submit.prevent="submitForm()">
|
||||
<form @submit.prevent="submitFormEdit()">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<input
|
||||
@ -163,11 +163,13 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import axios from "axios";
|
||||
import RequestMixin from "@/mixins/request.mixin"
|
||||
|
||||
import AutoComplete from "@/components/AutoComplete";
|
||||
|
||||
export default {
|
||||
name: "profileEdit",
|
||||
mixins: [RequestMixin],
|
||||
components: {
|
||||
AutoComplete,
|
||||
},
|
||||
@ -195,42 +197,7 @@ export default {
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
try {
|
||||
const userProfile = await axios.get(
|
||||
`${this.apiUrl}/users/${localStorage.getItem("user_id")}/profile`,
|
||||
{
|
||||
headers: { Authorization: `Bearer ${localStorage.getItem("token")}` },
|
||||
}
|
||||
);
|
||||
this.profile = userProfile.data.profile;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async submitForm() {
|
||||
try {
|
||||
const formSubmitResult = await axios.post(
|
||||
`${this.apiUrl}/users/${localStorage.getItem("user_id")}/profile`,
|
||||
this.profile,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
if (formSubmitResult.status === 200) {
|
||||
// success
|
||||
this.showSuccessMessage = true;
|
||||
} else {
|
||||
// failure
|
||||
this.showErrorMessage = true;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
this.showErrorMessage = true;
|
||||
}
|
||||
},
|
||||
await this.initEditPage();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -35,10 +35,13 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import RequestMixin from "@/mixins/request.mixin"
|
||||
|
||||
import ProfileList from "@/components/ProfileList";
|
||||
|
||||
export default {
|
||||
name: "profileView",
|
||||
mixins: [RequestMixin],
|
||||
components: {
|
||||
ProfileList,
|
||||
},
|
||||
@ -48,17 +51,7 @@ export default {
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
try {
|
||||
const userProfile = await this.axios.get(
|
||||
`${this.apiUrl}/users/${this.$route.params.memberId}/profile`,
|
||||
{
|
||||
headers: { Authorization: `Bearer ${localStorage.getItem("token")}` },
|
||||
}
|
||||
);
|
||||
this.profile = userProfile.data.profile;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
await this.initViewPage();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user