Skip to content

Commit d86796a

Browse files
committed
Ensure it works with credential in https://localhost
1 parent b0231f3 commit d86796a

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
},
4747
"scripts": {
4848
"start_win": "set PORT=61234 && react-scripts start",
49-
"start_unix": "export PORT=61234 && react-scripts start",
49+
"start_unix": "export PORT=61234 HTTPS=true && react-scripts start",
5050
"build": "CI=false react-scripts build",
5151
"test": "react-scripts test",
5252
"eject": "臭小子别乱碰这个 react-scripts eject"

src/Data/UserData.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export async function setUserInfo(user_info) {
7878
export async function logout() {
7979
const response = await fetch(LOGOUT, {
8080
method: 'POST',
81+
credentials: 'include',
8182
headers: await headerGenerator(true),
8283
})
8384
if (response.status !== 200 && response.status !== 401) {
@@ -136,6 +137,7 @@ export async function getAvatar(avatarId, displayName = null, isRefresh = false)
136137
if (isRefresh || !avatar || (Date.now() - avatar['Date']) > CACHE_EXPIRATION) {
137138
const response = await fetch(GET_AVATAR, {
138139
method: 'POST',
140+
credentials: 'include',
139141
headers: await headerGenerator(true),
140142
body: JSON.stringify({avatar_id: avatarId})
141143
})
@@ -212,6 +214,7 @@ export async function getDisplayName(isRefresh = false) {
212214
if (isRefresh || !displayName || (Date.now() - displayName['Date']) > CACHE_EXPIRATION) {
213215
const response = await fetch(GET_DISPLAY_NAME, {
214216
method: 'POST',
217+
credentials: 'include',
215218
headers: await headerGenerator(true),
216219
})
217220
await handleErrors(response);
@@ -242,6 +245,7 @@ export async function toggleAnonymous() {
242245

243246
const response = await fetch(TOGGLE_NICKNAME, {
244247
method: 'POST',
248+
credentials: 'include',
245249
headers: await headerGenerator(true),
246250
});
247251
await handleErrors(response);

0 commit comments

Comments
 (0)