Vue js PATCH http://127.0.0.1:8000/api/auth/profile 401 (не авторизовано) - PullRequest
0 голосов
/ 23 сентября 2019

У меня есть модал, где я могу создавать редактировать пользователей.Но когда я нажимаю на кнопку отправки, я получаю ошибку 401.

, и я хочу изменить имя без страницы обновления. Метод выглядит следующим образом:


    if(token){
      this.preformUpdate();
    }
  },
  methods: {
    preformUpdate: function() {
      this.loading = true;
      this.msgupdate = "Updated your profile";
      this.alert = true;
      axios
        .patch("/profile", {
          name: this.name,
          token: this.token
        })
        .then(response => {
          const name = localStorage.setItem("name", response.data.user.name);
          this.email = localStorage.getItem("email");
          console.log(response.data.user.name);
          this.loading = false;
        })
        .catch(error => {
          console.log(error);
          this.error = error.message;
          this.loading = false;
        });
    }
  } 
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...