提交 b15524bf 编写于 作者: ItbGcthate's avatar ItbGcthate

304_fix feature websockcet

上级 2061e024
...@@ -47,6 +47,7 @@ class TwoPlayerPKHome extends Component { ...@@ -47,6 +47,7 @@ class TwoPlayerPKHome extends Component {
joinMatch = () => { joinMatch = () => {
this.setState({isStarted: true, isCanceling: false}); this.setState({isStarted: true, isCanceling: false});
console.log('websocket 已打开'); console.log('websocket 已打开');
// console.log(websocket.get().readyState);
websocket.joinMatch(); websocket.joinMatch();
}; };
......
...@@ -14,7 +14,7 @@ export function login() { ...@@ -14,7 +14,7 @@ export function login() {
const resolveData = data => { const resolveData = data => {
console.log(data); console.log(data);
}; };
console.log('[Login] sno: ' + data.sno + ' password: ' + data.password); // console.log('[Login] sno: ' + data.sno + ' password: ' + data.password);
post(URL_LOGIN, data).then(resolveData).catch(); post(URL_LOGIN, data).then(resolveData).catch();
} }
...@@ -22,7 +22,7 @@ export function logout() { ...@@ -22,7 +22,7 @@ export function logout() {
const resolveData = data => { const resolveData = data => {
console.log(data); console.log(data);
}; };
console.log('[Logout]'); // console.log('[Logout]');
get(URL_LOGOUT, {}).then(resolveData).catch(); get(URL_LOGOUT, {}).then(resolveData).catch();
} }
......
...@@ -87,9 +87,10 @@ export class websocket { ...@@ -87,9 +87,10 @@ export class websocket {
static connect(functions) { static connect(functions) {
const url = URL_2PLAYER_PK_MATCH + sno.get(); const url = URL_2PLAYER_PK_MATCH + sno.get();
console.log(`[url_2player_PK_match] ${url}`); // console.log(`[url_2player_PK_match] ${url}`);
getCookies().then(cookies => { getCookies()
console.log('[cookies] ', cookies); .then(cookies => {
// console.log('[cookies] ', cookies);
let cookie = ''; let cookie = '';
for (let key in cookies) { for (let key in cookies) {
cookie += `${cookies[key].name}=${cookies[key].value}&`; cookie += `${cookies[key].name}=${cookies[key].value}&`;
...@@ -135,7 +136,8 @@ export class websocket { ...@@ -135,7 +136,8 @@ export class websocket {
console.log('websocket 发生了错误'); console.log('websocket 发生了错误');
}; };
} }
}); })
.catch();
} }
//打开事件 //打开事件
...@@ -332,7 +334,7 @@ export function post(url, data = {}) { ...@@ -332,7 +334,7 @@ export function post(url, data = {}) {
async function getCookies() { async function getCookies() {
return await CookieManager.get(URL_SHORT).then(res => { return await CookieManager.get(URL_SHORT).then(res => {
console.log('CookieManager.get =>', res); // console.log('CookieManager.get =>', res);
return res; return res;
}); });
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册