Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var token = JSON.parse(localStorage.getItem("vuex")).auth.token;
- var locationString = window.location.href;
- var split = locationString.split('-');
- for (var i in split) {
- if (split[i].length == 8) {
- joinBattle(split[i], token);
- console.log("trying to enter " + split[i]);
- }
- }
- function joinBattle(gameid, userToken) {
- fetch("https://api.daddyskins.com/api/arenas", {
- "credentials":"include",
- "headers":
- {
- "accept":"*/*",
- "accept-language":"he-IL,he;q=0.9,en-US;q=0.8,en;q=0.7,nl;q=0.6",
- "authorization":"Bearer " + userToken,
- "content-type":"application/json",
- "sec-fetch-mode":"cors",
- "sec-fetch-site":"same-site"
- },
- "body":"{\"operationName\":null,\"variables\":{},\"query\":\"mutation {\\n joinArena(uid: \\\"" + gameid + "\\\")\\n}\\n\"}","method":"POST","mode":"cors"
- }).then((response) => {
- return response.json();
- }).then((responseJson) => {
- console.log(responseJson);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement