MCPcopy
hub / github.com/kenberkeley/react-demo / xhr

Function xhr

src/services/xhr/jquery.js:3–19  ·  view source on GitHub ↗
({ url, body = null, method = 'get' })

Source from the content-addressed store, hash-verified

1import { rootPath, errHandler } from './config'
2
3const xhr = ({ url, body = null, method = 'get' }) => {
4 const defer = $.Deferred()
5
6 $.ajax({
7 type: method,
8 url: rootPath + url,
9 data: body
10 // xhrFields: { // 跨域允许带上 cookie
11 // withCredentials: [域名]
12 // },
13 // crossDomain: true
14 })
15 .done(defer.resolve)
16 .fail(errHandler)
17
18 return defer.promise()
19}
20
21export default xhr

Callers 7

fetchMethod · 0.85
addMethod · 0.85
modMethod · 0.85
delMethod · 0.85
checkLoginMethod · 0.85
loginMethod · 0.85
logoutMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected