{"action":"opened","issue":{"url":"https://api.github.com/repos/BranceLee/ES6-NoteBook/issues/3","repository_url":"https://api.github.com/repos/BranceLee/ES6-NoteBook","labels_url":"https://api.github.com/repos/BranceLee/ES6-NoteBook/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/BranceLee/ES6-NoteBook/issues/3/comments","events_url":"https://api.github.com/repos/BranceLee/ES6-NoteBook/issues/3/events","html_url":"https://github.com/BranceLee/ES6-NoteBook/issues/3","id":341532804,"node_id":"MDU6SXNzdWUzNDE1MzI4MDQ=","number":3,"title":"向接口请求数据","user":{"login":"BranceLee","id":37168881,"node_id":"MDQ6VXNlcjM3MTY4ODgx","avatar_url":"https://avatars0.githubusercontent.com/u/37168881?v=4","gravatar_id":"","url":"https://api.github.com/users/BranceLee","html_url":"https://github.com/BranceLee","followers_url":"https://api.github.com/users/BranceLee/followers","following_url":"https://api.github.com/users/BranceLee/following{/other_user}","gists_url":"https://api.github.com/users/BranceLee/gists{/gist_id}","starred_url":"https://api.github.com/users/BranceLee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BranceLee/subscriptions","organizations_url":"https://api.github.com/users/BranceLee/orgs","repos_url":"https://api.github.com/users/BranceLee/repos","events_url":"https://api.github.com/users/BranceLee/events{/privacy}","received_events_url":"https://api.github.com/users/BranceLee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-16T14:04:12Z","updated_at":"2018-07-16T14:04:12Z","closed_at":null,"author_association":"OWNER","body":"// 客户详情接口\r\nexport function Detail( value ){\r\n    return request( `${URL}/company/detal` , {\r\n         body:JSON.stringfy(value)\r\n} )\r\n\r\n//调用request\r\nexport default function request( url, options){\r\n     options={\r\n            method: 'POST' ,\r\n            body: option.body,\r\n            header:{\r\n                 'content-Type' : 'application/json ,\r\n                 },\r\n            credentials: \"include\"\r\n}\r\n    return  fetch(url , options )\r\n.then( response=>checkStatus )\r\n.then(response.parseJSON)\r\n.then(data =>{\r\n   const {errCode, errMsg}=data\r\n   if (errCode !==0){\r\n         message.error(errMsg);\r\n}\r\n    return data\r\n}).catch(err=>{\r\n console.log('报错信息'，err)\r\n})\r\n}\r\n\r\n\r\n//checkStatus检查服务器返回的状态\r\nfunction checkStatus(response){\r\n   if(response.status>200 && response.status <300 ){\r\n    return response\r\n  }\r\n  if( response.status===401){\r\n    if(window.location.pathname === '/login'){\r\n      message.error(\"账号或密码错误，请重新输入！\")\r\n }else{\r\n  message.error (\"系统异常\")\r\n  window.setTimeOut(()=>push('/login')),1000)\r\n }\r\n  return\r\n }\r\n  const error = new Error(response.statusText);\r\n  error.response = response;\r\n  throw error;\r\n}\r\n\r\n"}}
{"actor":{"display_login":"BranceLee"}}