async function authenticateUser(username, password) {
  const authData = {
    username,
    password
  };

  const response = await Axios.post(`${URL}/auth/authenticate`, authData);

  switch (response.status) {
    case 400:
      throw new Error("Username or password not provided");
    case 401:
      throw new Error("Incorrect username or password");
    case 500:
      throw new Error("Server error");
  }

  const token = await response.data.payload.token;
  store.commit("updateToken", token);
}
/**
 * Authenticate the user and return a token
 * @param username
 * @param password
 * @returns {Promise<string>}
 */
Authenticate the user and return a token
@param username
@param password
@returns {Promise}
Authenticate the user and return a token @param username @param password @returns { Promise }
async function authenticateUser(username, password) {
  const authData = {
    username,
    password
  };
  const response = await Axios.post(`${URL}/auth/authenticate`, authData);
  switch (response.status) {
    case 400:
      throw new Error("Username or password not provided");
    case 401:
      throw new Error("Incorrect username or password");
    case 500:
      throw new Error("Server error");
  }
  const token = await response.data.payload.token;
  store.commit("updateToken", token);
}
async function authenticateUser ( username , password ) { const authData = { username , password } ; const response = await Axios . post ( ` ${ URL } ` , authData ) ; switch ( response . status ) { case 400 : throw new Error ( "Username or password not provided" ) ; case 401 : throw new Error ( "Incorrect username or password" ) ; case 500 : throw new Error ( "Server error" ) ; } const token = await response . data . payload . token ; store . commit ( "updateToken" , token ) ; }
Authenticate the user and return a token
 @param username
 @param password
 @returns {Promise<string>}
Authenticate the user and return a token @param username @param password @returns { Promise<string > }