- async getEditUserServer() {
- await axios.patch(
- "http://localhost:3000/users/" + this.$route.query.id,
- this.editUser
- );
- this.toHomePage();
- },
editUserInfo() { - editUserInfo() {
- const editUser = {
- fullName: this.fullName,
- departament: this.departament,
- position: this.position,
- gender: this.newGender,
- age: +this.age,
- };
- this.editUser = editUser;
- console.log(this.editUser);
- this.getEditUserServer();
- },
- getRadioBtn(result) {
- this.newGender = result.target.value;
- console.log(this.newGender);
- },
Delete MB dan malumotlarni o’chirish Delete MB dan malumotlarni o’chirishning coding qismi - async deleteUser() {
- console.log(this.id);
- alert(`Rostdan ham ${this.fullName} ro'yxatdan o'chirmoqchimis!`);
- await axios.delete("http://localhost:3000/users/" + this.id);
- console.log("User o'chirildi");
- this.toHomePage();
- },
async mounted() { - async mounted() {
- const respons = await axios.get(
- "http://localhost:3000/users/" + this.$route.params.id
- );
- console.log(respons.data);
- const res = respons.data;
- this.fullName = res.fullName;
- this.departament = res.departament;
- this.position = res.position;
- this.gender = res.gender;
- this.age = res.age;
- },
- };
- sortDepartament() {
- this.sortNumberDepartament += 1;
- this.paginationUser = this.paginationUser2;
- if (this.sortNumberDepartament > 3) {
- this.sortNumberDepartament = 0;
- this.paginationUser = this.paginationUser2;
- }
- if (this.sortNumberDepartament === 1) {
- this.paginationUser = this.paginationUser.filter(
- (user) => user.departament === "IT"
- );
- } else if (this.sortNumberDepartament === 2) {
- this.paginationUser = this.paginationUser.filter(
- (user) => user.departament === "Marketing"
- );
- } else if (this.sortNumberDepartament === 3) {
- this.paginationUser = this.paginationUser.filter(
- (user) => user.departament === "Acounting"
- );
- } else {
- return this.paginationUser;
- }
- },
Do'stlaringiz bilan baham: |