Skip to content

Commit bca115c

Browse files
committed
Send cookies with requests
1 parent f106845 commit bca115c

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

frontend/javascript/modules/editUser.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ export default class EditUser {
2727
this.link.addEventListener("click", e => {
2828
e.preventDefault();
2929

30-
fetch(this.endpoints.userDetails + this.uid)
30+
fetch(this.endpoints.userDetails + this.uid, {
31+
method: 'GET',
32+
headers: {
33+
Accept: 'application/json'
34+
},
35+
credentials: "same-origin"
36+
})
3137
.then(FetchUtil.checkStatus)
3238
.then(FetchUtil.parseJSON)
3339
.then(data => {
@@ -289,6 +295,7 @@ export default class EditUser {
289295
'Accept': 'application/json',
290296
'Content-Type': 'application/json'
291297
},
298+
credentials: "same-origin",
292299
body: JSON.stringify(payload)
293300
})
294301
.then(FetchUtil.checkStatus)

frontend/javascript/modules/majorProjectStatus.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default class MajorProjectStatus {
3535
'Accept': 'application/json',
3636
'Content-Type': 'application/json'
3737
},
38+
credentials: "same-origin",
3839
body: JSON.stringify(payload)
3940
})
4041
.then(FetchUtil.checkStatus)

frontend/javascript/modules/memberSelect.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export default class MemberSelect {
1414
if (this.dataSrc) {
1515
fetch('/attendance/' + this.dataSrc, {
1616
method: 'GET',
17+
headers: {
18+
'Accept': 'application/json',
19+
'Content-Type': 'application/json'
20+
},
1721
credentials: 'same-origin'
1822
})
1923
.then(FetchUtil.checkResponse)

frontend/javascript/modules/siteSettings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default class SiteSettings {
3131
'Accept': 'application/json',
3232
'Content-Type': 'application/json'
3333
},
34+
credentials: "same-origin",
3435
body: JSON.stringify(payload)
3536
})
3637
.then(FetchUtil.checkStatus)

frontend/javascript/utils/fetchUtil.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default class FetchUtil {
2929
'Accept': 'application/json',
3030
'Content-Type': 'application/json'
3131
},
32+
credentials: "same-origin",
3233
body: JSON.stringify(payload)
3334
})
3435
.then(FetchUtil.checkStatus)
@@ -75,6 +76,7 @@ export default class FetchUtil {
7576
'Accept': 'application/json',
7677
'Content-Type': 'application/json'
7778
},
79+
credentials: "same-origin",
7880
body: JSON.stringify(payload)
7981
})
8082
.then(FetchUtil.checkStatus)
@@ -112,7 +114,8 @@ export default class FetchUtil {
112114
method: settings.method,
113115
headers: {
114116
Accept: 'application/json'
115-
}
117+
},
118+
credentials: "same-origin"
116119
})
117120
.then(FetchUtil.checkStatus)
118121
.then(FetchUtil.parseJSON)
@@ -157,7 +160,8 @@ export default class FetchUtil {
157160
method: settings.method,
158161
headers: {
159162
Accept: 'application/json'
160-
}
163+
},
164+
credentials: "same-origin"
161165
})
162166
.then(FetchUtil.checkStatus)
163167
.then(FetchUtil.parseJSON)

0 commit comments

Comments
 (0)