File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -191,6 +191,14 @@ function cleanUrl(url) {
191191 return typeof url === ' string' ? url .split (' ?' )[0 ] : ' '
192192}
193193
194+ function sanitizePayload (payload ) {
195+ const cleanPayload = {}
196+ Object .keys (payload).forEach ((key ) => {
197+ cleanPayload[key] = payload[key] === ' ' ? null : payload[key]
198+ })
199+ return cleanPayload
200+ }
201+
194202async function saveProfile () {
195203 try {
196204 let imageUrl = ' '
@@ -208,7 +216,7 @@ async function saveProfile() {
208216 imageUrl = cleanUrl (props .profile .profileImage )
209217 }
210218
211- const payload = {
219+ const rawPayload = {
212220 nickname: editableProfile .nickname ,
213221 age: editableProfile .age ,
214222 region: editableProfile .region ,
@@ -218,7 +226,8 @@ async function saveProfile() {
218226 profileImage: imageUrl,
219227 }
220228
221- // ★ PATCH 한 번만, 그리고 응답으로 스토어 갱신
229+ const payload = sanitizePayload (rawPayload)
230+
222231 const { data: updated } = await patchProfileById (props .profile .memberId , payload)
223232
224233 auth .updateUserProfile (updated)
@@ -227,7 +236,7 @@ async function saveProfile() {
227236 } catch (err) {
228237 console .error (' 프로필 저장 실패' , err)
229238 }
230- }
239+ }
231240< / script>
232241< style scoped>
233242.introduce - box {
You can’t perform that action at this time.
0 commit comments