Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
InventivetalentDev committed Apr 17, 2022
1 parent 69dcab4 commit 66c175c
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions client/src/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ async function init() {
try {
initInfo = await fetch(endpoint + '/hello', {
credentials: 'include',
headers: {
'Content-Type': 'application/json'
}
}).then(res => res.json());
} catch (e) {
console.warn(e);
Expand All @@ -76,6 +79,9 @@ async function init() {
initInfo = await fetch(endpoint + '/register', {
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'application/json'
}
}).then(res => res.json());
} catch (e) {
console.warn(e);
Expand Down Expand Up @@ -152,7 +158,10 @@ function getState() {
}

fetch(endpoint + '/state', {
credentials: 'include'
credentials: 'include',
headers: {
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(res => {
Expand Down Expand Up @@ -201,7 +210,11 @@ function getInfo() {
return;
}

fetch(endpoint + '/info')
fetch(endpoint + '/info', {
headers: {
'Content-Type': 'application/json'
}
})
.then(res => {
try {
const v = parseInt(res.headers.get('x-canvas-version')!);
Expand Down Expand Up @@ -232,7 +245,11 @@ function getInfo() {

function getPixelInfo(x: number, y: number) {
modifiedInfo.style.display = 'none';
fetch(endpoint + '/info/' + x + '/' + y)
fetch(endpoint + '/info/' + x + '/' + y, {
headers: {
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(i => {
if (!i || !i.mod) return;
Expand Down

0 comments on commit 66c175c

Please sign in to comment.