等待Javascript是保留字吗?

时间:2019-06-10 15:33:10

标签: javascript

我认为我做的一切正确。但是程序在await is a reserved keyword函数中显示“ signin”。这是代码:

import axios from "axios";
const signin = async (username, password) => {
  try {
    console.log("Sign in function called");
    const res = await axios.post(`${process.env.baseURL}/auth/signin`, {
      username,
      password
    });
    console.log(res.data);
  } catch (error) {
    console.log(error);
  }
};

const logout = () => {
  // remove user from local storage to log user out
  localStorage.removeItem("jobmanager_user");
};

export const userService = {
  signin,
  logout
};

0 个答案:

没有答案