Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Front/fix/matching page css #33

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions frontend/src/components/Edit-Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ export class EditProfile extends Component {
this.state.img_url = data.img_url;
this.state.is_2FA = data.is_2FA;
})
.catch(error => console.error('Fetch error:', error));
.catch(error => {
console.error('Fetch error:', error);
changeUrl("/");
});
return { nickname: this.nickname, img_url: this.img_url, is_2FA: this.is_2FA };
}

Expand Down Expand Up @@ -182,7 +185,10 @@ export class EditProfile extends Component {
if (response.ok) changeUrl(`/`);
else throw new Error('Network response was not ok');
})
.catch(error => console.error('Fetch error:', error));
.catch(error => {
console.error('Fetch error:', error);
changeUrl("/");
});
});

this.addEvent('click', '#profileChange', async (event) => {
Expand Down Expand Up @@ -217,7 +223,8 @@ export class EditProfile extends Component {
changeUrl(`/main/profile/${this.props.uid}/edit`);
})
.catch(error => {
console.error('Error updating profile:', error);
console.error('Fetch error:', error);
changeUrl("/");
});
});
}
Expand Down
18 changes: 14 additions & 4 deletions frontend/src/components/Friends-List.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export class FriendsList extends Component {
{ className: "fList", ids: friendIdList, contents: friendNicknameList }));
})
.catch(error => {
console.error('Fetch operation failed:', error);
console.error('Fetch error:', error);
changeUrl("/");
});
}

Expand Down Expand Up @@ -177,7 +178,10 @@ export class FriendsList extends Component {
}
changeUrl(window.location.pathname);
})
.catch(error => console.error('Error:', error));
.catch(error => {
console.error('Fetch error:', error);
changeUrl("/");
});
}
}

Expand Down Expand Up @@ -224,7 +228,10 @@ export class FriendsList extends Component {
searchResults.appendChild(div);
});
})
.catch(error => console.error('Error:', error));
.catch(error => {
console.error('Fetch error:', error);
changeUrl("/");
});
})

this.addEvent('click', '#searchResults', (event) => {
Expand Down Expand Up @@ -255,7 +262,10 @@ export class FriendsList extends Component {
}
changeUrl(window.location.pathname);
})
.catch(error => console.error('Error:', error));
.catch(error => {
console.error('Fetch error:', error);
changeUrl("/");
});
});
}
}
13 changes: 11 additions & 2 deletions frontend/src/components/Main-Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,14 @@ export class Menu extends Component {
})
})
.then(response => {
if (!response.ok) changeUrl("/");
if (!response.ok) {
throw new Error('Network response was not ok');
}
})
.catch(error => {
console.error('Fetch error:', error);
changeUrl("/");
});
changeUrl("/main");
}

Expand Down Expand Up @@ -112,7 +118,10 @@ export class Menu extends Component {
if (response.ok) changeUrl(`/`);
else throw new Error('Network response was not ok');
})
.catch(error => console.error('Fetch error:', error));
.catch(error => {
console.error('Fetch error:', error);
changeUrl("/");
});
});
}
}
44 changes: 24 additions & 20 deletions frontend/src/components/Profile-Info.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,31 @@ export class ProfileInfo extends Component {
this.user = {win: null, lose: null, img_url: null, nickname: null, uid: null};
this.rate = null;
this.games = null;
fetch(`https://localhost:443/api/user/${this.props.uid}`, {
method: 'GET',
credentials: 'include', // 쿠키를 포함하여 요청 (사용자 인증 필요 시)
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
this.state.games = data.games;
this.state.user = data.user;
this.state.rate = data.user.lose == 0 ? (data.user.win == 0 ? 0 : 100) :
Math.round((data.user.win / (data.user.lose + data.user.win)) * 100);
})
.catch(error => {
console.error('Fetch error:', error);
if (this.uid !== parseInt(this.props.uid)) {
changeUrl("/404", false);
});
} else {
fetch(`https://localhost:443/api/user/${this.props.uid}`, {
method: 'GET',
credentials: 'include', // 쿠키를 포함하여 요청 (사용자 인증 필요 시)
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
x } else {
return response.json();
}
})
.then(data => {
this.state.games = data.games;
this.state.user = data.user;
this.state.rate = data.user.lose == 0 ? (data.user.win == 0 ? 0 : 100) :
Math.round((data.user.win / (data.user.lose + data.user.win)) * 100);
})
.catch(error => {
console.error('Fetch error:', error);
changeUrl("/");
});
}
return { user: this.user, rate: this.rate, games: this.games };
}

Expand Down Expand Up @@ -135,7 +140,6 @@ export class ProfileInfo extends Component {
changeUrl(`/main/profile/${this.props.uid}/edit`);
});

// 컴포넌트가 렌더링된 후 원형 진행 막대를 그립니다.
}

drawBackgroundCircle() {
Expand Down
Loading
Loading