-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 계정정보수정페이지 수정, 보호소앱의 보호소 마이페이지 수정 (#301)
* feat(volunteer): queryClient staleTime 5000 변경 * fix(volunteer): 봉사자 계정정보 수정된 경우 캐싱된 데이터 수정 * refactor(shelter): 보호소 정보 Fetch 훅 수정 * refactor(shelter): 보호소 마이페이지 수정 * fix(shelter): 보호소 계정정보 수정, validation 추가 * feat(shelter): suspense 추가 * fix(shelter): conflict 해결
- Loading branch information
Showing
7 changed files
with
260 additions
and
156 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
apps/shelter/src/pages/my/_hooks/useFetchShelterProfile.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
|
||
import { getShelterInfoAPI } from '@/apis/shelter'; | ||
import { ShelterInfo } from '@/types/apis/shetler'; | ||
|
||
type ShelterProfile = { | ||
shelterId: number; | ||
imageUrl: string; | ||
name: string; | ||
email: string; | ||
phoneNumber: string; | ||
sparePhoneNumber: string; | ||
address: string; | ||
addressDetail: string; | ||
isOpenedAddress: boolean; | ||
}; | ||
|
||
const createProfile = (response: ShelterInfo): ShelterProfile => { | ||
const { | ||
shelterId, | ||
shelterImageUrl, | ||
shelterName, | ||
shelterEmail, | ||
shelterPhoneNumber, | ||
shelterSparePhoneNumber, | ||
shelterAddress, | ||
shelterAddressDetail, | ||
shelterIsOpenedAddress, | ||
} = response; | ||
return { | ||
shelterId, | ||
imageUrl: shelterImageUrl, | ||
name: shelterName, | ||
email: shelterEmail, | ||
phoneNumber: shelterPhoneNumber, | ||
sparePhoneNumber: shelterSparePhoneNumber, | ||
address: shelterAddress, | ||
addressDetail: shelterAddressDetail, | ||
isOpenedAddress: shelterIsOpenedAddress, | ||
}; | ||
}; | ||
|
||
const useFetchShelterProfile = () => | ||
useSuspenseQuery({ | ||
queryKey: ['shelterProfile'], | ||
queryFn: async () => { | ||
const response = (await getShelterInfoAPI()).data; | ||
return createProfile(response); | ||
}, | ||
}); | ||
|
||
export default useFetchShelterProfile; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
apps/shelter/src/pages/settings/account/_hooks/useFetchShelterAccount.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.