Skip to content

Commit 5cb248c

Browse files
Merge pull request #67 from pirogramming/feat-chan
Feat chan
2 parents 21a7e23 + 06a06cf commit 5cb248c

12 files changed

Lines changed: 50 additions & 166 deletions

File tree

backend-core/static/users/css/announcement.css

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,6 @@ body {
3131
border-bottom: 1px solid #f1f3f5;
3232
}
3333

34-
#back-arrow {
35-
text-decoration: none;
36-
color: #333333;
37-
font-size: 24px;
38-
font-weight: 300;
39-
margin-right: 12px; /* 타이틀과의 간격 확보 */
40-
display: flex;
41-
align-items: center;
42-
justify-content: center;
43-
width: 32px;
44-
height: 32px;
45-
}
46-
4734
.header-title {
4835
font-size: 18px;
4936
font-weight: 700;

backend-core/static/users/css/homepage.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ margin-bottom: 20px;
119119
.mission-status-card {
120120
/* 배경색: 흰색 70~80% 투명도 */
121121
background: rgba(255, 255, 255, 0.75);
122-
width:320px;
123122
/* 뒤 배경 블러 처리 (불투명한 느낌의 핵심) */
124123
backdrop-filter: blur(10px);
125124
-webkit-backdrop-filter: blur(10px);

backend-core/static/users/css/login.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ input {
182182
margin-left: 15px;
183183
}
184184

185-
.signup-container::after {
186-
content: "로그인 시 Uniquest의 이용약관 및 개인정보처리방침에 동의하는 것으로 간주됩니다.";
185+
#announcement {
187186
display: block;
188187
margin-top: auto;
189188
margin-bottom: 20px;
@@ -194,4 +193,8 @@ input {
194193
color: #667085;
195194
line-height: 1.6;
196195
text-align: left;
196+
}
197+
198+
#announcement a{
199+
text-decoration: underline;
197200
}

backend-core/static/users/css/mypage.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ body {
225225

226226
/* ---------- 내 리뷰 보기 토글 (시안 스타일) ---------- */
227227
.menu-item.my-reviews-toggle {
228-
background: linear-gradient(90deg, #FFF9E6 0%, #FFFFFF 100%);
229-
border-left: 4px solid #FFB800;
230228
cursor: pointer;
231229
}
232230

backend-core/staticfiles/users/css/announcement.css

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,6 @@ body {
3131
border-bottom: 1px solid #f1f3f5;
3232
}
3333

34-
#back-arrow {
35-
text-decoration: none;
36-
color: #333333;
37-
font-size: 24px;
38-
font-weight: 300;
39-
margin-right: 12px; /* 타이틀과의 간격 확보 */
40-
display: flex;
41-
align-items: center;
42-
justify-content: center;
43-
width: 32px;
44-
height: 32px;
45-
}
46-
4734
.header-title {
4835
font-size: 18px;
4936
font-weight: 700;

backend-core/staticfiles/users/css/homepage.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ margin-bottom: 20px;
119119
.mission-status-card {
120120
/* 배경색: 흰색 70~80% 투명도 */
121121
background: rgba(255, 255, 255, 0.75);
122-
width:320px;
123122
/* 뒤 배경 블러 처리 (불투명한 느낌의 핵심) */
124123
backdrop-filter: blur(10px);
125124
-webkit-backdrop-filter: blur(10px);

backend-core/staticfiles/users/css/login.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ input {
182182
margin-left: 15px;
183183
}
184184

185-
.signup-container::after {
186-
content: "로그인 시 Uniquest의 이용약관 및 개인정보처리방침에 동의하는 것으로 간주됩니다.";
185+
#announcement {
187186
display: block;
188187
margin-top: auto;
189188
margin-bottom: 20px;
@@ -194,4 +193,8 @@ input {
194193
color: #667085;
195194
line-height: 1.6;
196195
text-align: left;
196+
}
197+
198+
#announcement a{
199+
text-decoration: underline;
197200
}

backend-core/staticfiles/users/css/mypage.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ body {
225225

226226
/* ---------- 내 리뷰 보기 토글 (시안 스타일) ---------- */
227227
.menu-item.my-reviews-toggle {
228-
background: linear-gradient(90deg, #FFF9E6 0%, #FFFFFF 100%);
229-
border-left: 4px solid #FFB800;
230228
cursor: pointer;
231229
}
232230

backend-core/staticfiles/users/js/blocked_users.js

Lines changed: 13 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,9 @@ function getCookie(name) {
1515
}
1616

1717
async function getuserData() {
18-
// 1. 금고(로컬스토리지)에서 토큰 꺼내기
19-
const token = localStorage.getItem('access_token');
20-
21-
if (!token) {
22-
console.warn("로그인 토큰이 없습니다.");
23-
return null;
24-
}
25-
26-
try {
27-
const response = await fetch('/api/users/api/blocked_users/', {
28-
headers: {
29-
'Authorization': 'Bearer ' + token,
30-
'Content-Type': 'application/json',
31-
},
32-
});
33-
34-
if (response.ok) {
35-
const userData = await response.json();
36-
console.log("유저 정보 로드 성공:", userData);
37-
return userData;
38-
} else {
39-
const text = await response.text();
40-
try {
41-
const err = JSON.parse(text);
42-
console.error("API 오류:", err);
43-
} catch (_) {
44-
console.error("응답이 JSON이 아님 (로그인 필요할 수 있음)");
45-
}
46-
return null;
47-
}
48-
} catch (error) {
49-
console.error("네트워크 오류 발생:", error);
50-
return null;
51-
}
18+
const userData = await Auth.getData('/api/users/api/blocked_users/');
19+
if (userData) console.log("유저 정보 로드 성공:", userData);
20+
return userData;
5221
}
5322

5423
async function renderBlockUser() {
@@ -87,41 +56,16 @@ async function renderBlockUser() {
8756
}
8857
}
8958

90-
async function transmit_user_id(target_id){
91-
92-
const token = localStorage.getItem('access_token');
93-
94-
if (!token) {
95-
alert("로그인 정보가 없습니다.");
96-
return;
97-
}
98-
try {
99-
// 2. 백엔드 API에 토큰을 담아서 던지기 (fetch)
100-
const response = await fetch('/api/users/api/blocked_users/', {
101-
method: 'POST',
102-
headers: {
103-
'Content-Type': 'application/json',
104-
'Authorization': 'Bearer ' + token,
105-
'X-CSRFToken': getCookie('csrftoken')
106-
},
107-
body: JSON.stringify({ target_id: target_id })
108-
});
109-
110-
if (response.ok) {
111-
const response_json = await response.json();
112-
const message = response_json.message;
113-
alert(message)
114-
location.reload();
115-
} else {
116-
console.error("토큰이 만료되었거나 유효하지 않습니다.");
117-
alert('노 토큰')
118-
// window.location.href = '/users/login/';
119-
return null;
120-
}
121-
122-
} catch (error) {
123-
console.error("네트워크 오류 발생:", error);
124-
return null;
59+
async function transmit_user_id(target_id) {
60+
const response_json = await Auth.postData(
61+
'/api/users/api/blocked_users/',
62+
{ target_id: target_id },
63+
false,
64+
{ headers: { 'X-CSRFToken': getCookie('csrftoken') } }
65+
);
66+
if (response_json && response_json.message) {
67+
alert(response_json.message);
68+
location.reload();
12569
}
12670
}
12771

backend-core/staticfiles/users/js/mypage_modify.js

Lines changed: 19 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,9 @@ function getCookie(name) {
1414
}
1515

1616
async function getUserData() {
17-
const token = localStorage.getItem('access_token');
18-
19-
if (!token) {
20-
console.warn("로그인 토큰이 없습니다.");
21-
return null;
22-
}
23-
24-
try {
25-
const response = await fetch('/api/users/api/profile_modify/');
26-
27-
if (response.ok) {
28-
const userData = await response.json();
29-
console.log("유저 정보 로드 성공:", userData);
30-
return userData;
31-
} else {
32-
alert('토큰이 만료되었거나 유효하지 않습니다.')
33-
console.error("토큰이 만료되었거나 유효하지 않습니다.");
34-
window.location.href = '/api/users/login/';
35-
return null;
36-
}
37-
} catch (error) {
38-
console.error("네트워크 오류 발생:", error);
39-
return null;
40-
}
17+
const userData = await Auth.getData('/api/users/api/profile_modify/');
18+
if (userData) console.log("유저 정보 로드 성공:", userData);
19+
return userData;
4120
}
4221

4322
async function renderProfile() {
@@ -67,51 +46,31 @@ async function renderProfile() {
6746
}
6847

6948
async function patchProfile() {
70-
const token = localStorage.getItem('access_token');
71-
72-
if (!token) {
73-
alert("로그인이 만료되었습니다. 다시 로그인해주세요.");
74-
window.location.href = '/api/users/login/';
75-
return;
76-
}
77-
7849
const username = document.getElementById('user-username').value;
79-
const userInput = document.getElementById('userphoto')
50+
const userInput = document.getElementById('userphoto');
8051
const formData = new FormData();
81-
82-
formData.append('username',username)
52+
formData.append('username', username);
8353
if (userInput.files.length > 0) {
8454
formData.append('user_photo', userInput.files[0]);
8555
}
8656

87-
try {
88-
// 2. 백엔드 PATCH API 호출
89-
const response = await fetch('/api/users/api/profile_modify/', {
90-
method: 'PATCH',
91-
headers: {
92-
'X-CSRFToken': getCookie('csrftoken'),
93-
},
94-
body: formData
95-
});
96-
97-
if (response.ok) {
98-
alert("프로필이 성공적으로 변경되었습니다!");
99-
window.location.href = '/api/users/mypage/'; // 저장 후 마이페이지로 이동
100-
} else {
101-
const errorData = await response.json();
102-
alert("수정 실패: " + (errorData.detail || "오류가 발생했습니다."));
103-
}
104-
} catch (error) {
105-
console.error("네트워크 오류:", error);
106-
alert("서버 연결에 실패했습니다. 인터넷 연결을 확인해주세요.");
57+
const result = await Auth.patchData(
58+
'/api/users/api/profile_modify/',
59+
formData,
60+
true,
61+
{ headers: { 'X-CSRFToken': getCookie('csrftoken') } }
62+
);
63+
if (result !== null) {
64+
alert("프로필이 성공적으로 변경되었습니다!");
65+
window.location.href = '/api/users/mypage/';
66+
} else {
67+
alert("수정 실패: 오류가 발생했습니다.");
10768
}
108-
};
69+
}
10970

110-
function logout(){
111-
localStorage.removeItem('access_token');
112-
localStorage.removeItem('refresh_token');
71+
function logout() {
11372
alert('로그아웃 되었습니다');
114-
window.location.href = "/users/login/";
73+
Auth.logout("/api/users/login/");
11574
}
11675

11776
function previewImage(input) {

0 commit comments

Comments
 (0)