-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcs.js
28 lines (27 loc) · 814 Bytes
/
cs.js
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
28
function patchGQLQuery(obj)
{
team_condition = {"state":{"_eq":"soft_launched"}};
where_clause = obj["variables"]["where"];
if(where_clause === null || where_clause === undefined){
where_clause = {};
}
where_clause["team"] = team_condition;
obj["variables"]["where"] = where_clause;
console.log(obj);
return obj;
}
const Mock = window.fetch;
console.log("Patching fetch");
window.fetch = function() {
if(arguments[0] == "/graphql")
{
obj = JSON.parse(arguments[1]["body"]);
operation = obj["operationName"];
if(operation == "HacktivityPageQuery")
{
console.log("HacktivityPageQuery found!");
arguments[1]["body"] = JSON.stringify(patchGQLQuery(obj));
}
}
return Mock.apply(this, arguments);
}