File tree Expand file tree Collapse file tree
app/(auth)/(navigationsBarLayout)/mypage/tab Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import { ModifyForm } from '../ui/ModifyForm';
2222import { useQueryClient } from '@tanstack/react-query' ;
2323import { Badge } from '@/shared/ui/badge/Badge' ;
2424import { toast } from 'sonner' ;
25+ import { useUserStore } from '@/entities/user/model/store' ;
2526
2627export const Mine = ( ) => {
2728 const queryClient = useQueryClient ( ) ;
@@ -53,7 +54,7 @@ export const Mine = () => {
5354 const { mutateAsync : emailVerfiy } = useEmailVerify ( BASE_URL || '' ) ;
5455 const { mutateAsync : modify } = useModifyInfo ( ) ;
5556 const [ languageList , setLanguageList ] = useState < { label : string ; value : string } [ ] > ( [ ] ) ;
56-
57+ const { setUser } = useUserStore ( ) ;
5758 const myInfo = data ?. data . result ;
5859 const myRanking = ranking ?. data . result ;
5960
@@ -133,7 +134,9 @@ export const Mine = () => {
133134 request : body ,
134135 image : editForm . profileImage ?? undefined ,
135136 } ) ;
136-
137+ // setUser()
138+ console . log ( response ) ;
139+ setUser ( response . result ) ;
137140 toast . success ( response . message , {
138141 richColors : false ,
139142 style : {
Original file line number Diff line number Diff line change 88 ILanguages ,
99 IModifyBody ,
1010 IMyInfo ,
11+ IUserInfoModifyResponse ,
1112 Ranking ,
1213 Report ,
1314 SubmissionsResonse ,
@@ -127,8 +128,7 @@ export const useModifyInfo = () => {
127128 request : IModifyBody ; // 닉네임, 블로그, 깃허브 등 정보
128129 image ?: File ; // 프로필 이미지 (선택)
129130 } ) => {
130- console . log ( 'image' , image ) ;
131- console . log ( 'request' , request ) ;
131+
132132 const formData = new FormData ( ) ;
133133
134134 // request(JSON) 추가
@@ -139,7 +139,7 @@ export const useModifyInfo = () => {
139139 formData . append ( 'image' , image ) ;
140140 }
141141
142- const response = await ApiHelper . put ( API_URL . MYPAGE . USER_INFO , formData , {
142+ const response = await ApiHelper . put < IUserInfoModifyResponse > ( API_URL . MYPAGE . USER_INFO , formData , {
143143 headers : { 'Content-Type' : 'multipart/form-data' } ,
144144 } ) ;
145145
Original file line number Diff line number Diff line change @@ -104,3 +104,29 @@ export type IModifyBody = {
104104 age : number ;
105105 languageId : number | null ;
106106} ;
107+
108+
109+
110+ export interface IUserInfoModifyResponse {
111+ age : number ;
112+ blogUrl : string ;
113+ email : string ;
114+ githubUrl : string ;
115+ introduction : string ;
116+ language : Language ;
117+ nickname : string ;
118+ profileImageUrl : string ;
119+ tier : string ;
120+ totalSolvedCount : number ;
121+ userAuthTypes : string [ ]
122+ userRole : string ;
123+ username : string ;
124+ verified : boolean ;
125+ }
126+
127+ export interface Language {
128+ id : number ;
129+ judge0Id : number ;
130+ name : string ;
131+ version : string ;
132+ }
You can’t perform that action at this time.
0 commit comments