websanova / vue-auth

A simple light-weight authentication library for Vue.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Save response from server

roma177 opened this issue · comments

I have the following code which works, but it is not clear from where in vue-auth api call goes (to add callack saving response.) I need to save response from server. How can I do that?

loginData: {
    url: "/users/login",
    fetchUser: false,
    redirect: { name: ROUTE_NAME_HOME }
  }
        try {
          const { email, password } = this.model.find(this.id);
          const { data } = await this.$auth.login({
            data: {
              email,
              password
            }
          });
          this.$auth.user(data);
        } catch (err) {
          if (err.response) {
            this.processAPIErrors(err);
          }
        }