-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcompat.js
More file actions
27 lines (25 loc) · 771 Bytes
/
compat.js
File metadata and controls
27 lines (25 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var Relay = require('react-relay/compat');
function commitMutationPromise(environment, config) {
return new Promise(function (resolve, reject) {
Relay.commitMutation(
environment,
Object.assign(
{},
config,
{
onCompleted: function (payload, errors) {
if (errors) {
reject(errors[0]);
return;
}
resolve(payload);
},
onError: function (error) {
reject(error);
}
}
)
);
});
}
module.exports = commitMutationPromise;