GET API请求无效404错误

时间:2018-03-26 13:52:35

标签: javascript reactjs api react-redux axios

是否有人熟悉OpenWeather API并且最近遇到过任何问题? 我跟随Stephen Grider的React和Redux课程,我必须与他们建立API连接,直到今天,这一切都没问题,现在我收到了404错误?有谁熟悉这个?

这是我的代码:

import axios from "axios";

const API_KEY = "3ce22afbb4c9b6c452574b28666ed63d";
const ROOT_URL = `http://api.openweathermap.org/data/2.5/forecast?appid=${API_KEY}`;

export const FETCH_WEATHER = "FETCH_WEATHER";

export function fetchWeather(city) {
  const url = `${ROOT_URL}&q=${city},us`;
  const request = axios.get(url);

  return {
    type: FETCH_WEATHER,
    payload: request
  };
}

我已经删除了前3个和后3个字符。

0 个答案:

没有答案