Skip to content
Snippets Groups Projects
Select Git revision
  • 1665a5a3bf344371a97dbd4efa60d7762f005799
  • master default
2 results

utils.py

Blame
  • Forked from Automatants / Facial expression detection
    Source project has a limited visibility.
    Users.vue 982 B
    <template>
      <h1>Users</h1>
      <AddUser @userAdded="fetchUsers()" />
      <UsersTable v-if="users.length" :users="users" @userDeleted="fetchUsers()" />
      <div v-if="usersLoadingError">{{ usersLoadingError }}</div>
    </template>
    
    <script>
    // @ is an alias to /src
    import UsersTable from "@/components/UsersTable.vue";
    import axios from "axios";
    import AddUser from "./AddUser.vue";
    
    export default {
      name: "Users",
      components: {
        AddUser,
        UsersTable,
      },
      data: function () {
        return {
          users: [],
          usersLoadingError: "",
        };
      },
      methods: {
        fetchUsers: function () {
          axios
            .get(`${process.env.VUE_APP_BACKEND_BASE_URL}/users`)
            .then((response) => {
              this.users = response.data.users;
            })
            .catch((error) => {
              this.usersLoadingError = "An error occured while fetching users.";
              console.error(error);
            });
        },
      },
      mounted: function () {
        this.fetchUsers();
      },
    };
    </script>