Advertisement
Hirsw0w

Untitled

Jan 19th, 2020
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. var token = JSON.parse(localStorage.getItem("vuex")).auth.token;
  2.  
  3. var locationString = window.location.href;
  4. var split = locationString.split('-');
  5. for (var i in split) {
  6. if (split[i].length == 8) {
  7. joinBattle(split[i], token);
  8.  
  9. console.log("trying to enter " + split[i]);
  10. }
  11. }
  12.  
  13. function joinBattle(gameid, userToken) {
  14. fetch("https://api.daddyskins.com/api/arenas", {
  15. "credentials":"include",
  16. "headers":
  17. {
  18. "accept":"*/*",
  19. "accept-language":"he-IL,he;q=0.9,en-US;q=0.8,en;q=0.7,nl;q=0.6",
  20. "authorization":"Bearer " + userToken,
  21. "content-type":"application/json",
  22. "sec-fetch-mode":"cors",
  23. "sec-fetch-site":"same-site"
  24. },
  25. "body":"{\"operationName\":null,\"variables\":{},\"query\":\"mutation {\\n joinArena(uid: \\\"" + gameid + "\\\")\\n}\\n\"}","method":"POST","mode":"cors"
  26. }).then((response) => {
  27. return response.json();
  28. }).then((responseJson) => {
  29. console.log(responseJson);
  30. });
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement