-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
103 additions
and
45 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { useQuery } from 'react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { getBookDetail } from '../api/getBookDetail'; | ||
|
||
export default function useGetBookDetail(bookUuid: string) { | ||
const { data: bookDetail } = useQuery( | ||
const navigate = useNavigate(); | ||
const { data: bookDetail, isLoading } = useQuery( | ||
['useGetBookDetail', bookUuid], | ||
() => getBookDetail(bookUuid), | ||
{ | ||
onError: () => { | ||
console.error; | ||
navigate('/error'); | ||
}, | ||
}, | ||
); | ||
|
||
return { bookDetail }; | ||
return { bookDetail, isLoading }; | ||
} |
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
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import { useQuery } from 'react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import getLecueBook from '../api/getLecueBook'; | ||
|
||
const useGetLecueBook = () => { | ||
const { isLoading, error, data } = useQuery({ | ||
const navigate = useNavigate(); | ||
|
||
const { isLoading, data } = useQuery({ | ||
queryKey: ['get-lecue-book'], | ||
queryFn: () => getLecueBook(), | ||
onError: () => navigate('/error'), | ||
}); | ||
|
||
return { isLoading, error, data }; | ||
return { isLoading, data }; | ||
}; | ||
|
||
export default useGetLecueBook; |
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
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import { useQuery } from 'react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import getPresignedUrl from '../api/getPresignedUrl'; | ||
|
||
const useGetPresignedUrl = () => { | ||
const { isLoading, error, data } = useQuery({ | ||
const navigate = useNavigate(); | ||
|
||
const { isLoading, data } = useQuery({ | ||
queryKey: ['get-presigned-url'], | ||
queryFn: () => getPresignedUrl(), | ||
onError: () => navigate('/error'), | ||
}); | ||
|
||
return { isLoading, error, data }; | ||
return { isLoading, data }; | ||
}; | ||
|
||
export default useGetPresignedUrl; |
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
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
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
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
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 |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { useQuery } from 'react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { getMyBookList } from '../api/getMyBookList'; | ||
|
||
export default function useGetMyBookList() { | ||
const { data: myBookList } = useQuery( | ||
const navigate = useNavigate(); | ||
const { data: myBookList, isLoading } = useQuery( | ||
['useGetMyBookList'], | ||
() => getMyBookList(), | ||
{ | ||
onError: () => { | ||
console.error; | ||
navigate('/error'); | ||
}, | ||
}, | ||
); | ||
|
||
return { myBookList }; | ||
return { myBookList, isLoading }; | ||
} |
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 |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { useQuery } from 'react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { getMyNickName } from '../api/getMyNickName'; | ||
|
||
export default function useGetMyNickName() { | ||
const { data: myNickName } = useQuery( | ||
const navigate = useNavigate(); | ||
const { data: myNickName, isLoading } = useQuery( | ||
['useGetMyNickName'], | ||
() => getMyNickName(), | ||
{ | ||
onError: () => { | ||
console.error; | ||
navigate('/error'); | ||
}, | ||
}, | ||
); | ||
|
||
return { myNickName }; | ||
return { myNickName, isLoading }; | ||
} |
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 |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { useQuery } from 'react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { getMyNoteList } from '../api/getMyNoteList'; | ||
|
||
export default function useGetNoteList() { | ||
const { data: myNoteList } = useQuery( | ||
const navigate = useNavigate(); | ||
const { data: myNoteList, isLoading } = useQuery( | ||
['useGetNoteList'], | ||
() => getMyNoteList(), | ||
{ | ||
onError: () => { | ||
console.error; | ||
navigate('/error'); | ||
}, | ||
}, | ||
); | ||
|
||
return { myNoteList }; | ||
return { myNoteList, isLoading }; | ||
} |
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
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
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 |
---|---|---|
@@ -1,17 +1,20 @@ | ||
import { useQuery } from 'react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { getBookUuid } from '../api/getBookUuid'; | ||
|
||
export default function useGetBookUuid(bookId: number) { | ||
const { data: bookUuId } = useQuery( | ||
const navigate = useNavigate(); | ||
|
||
const { data: bookUuId, isLoading } = useQuery( | ||
['useGetBookUuid'], | ||
() => getBookUuid(bookId), | ||
{ | ||
onError: () => { | ||
console.error; | ||
navigate('/error'); | ||
}, | ||
}, | ||
); | ||
|
||
return { bookUuId }; | ||
return { bookUuId, isLoading }; | ||
} |
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 |
---|---|---|
@@ -1,17 +1,20 @@ | ||
import { useQuery } from 'react-query'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { getStickerPack } from '../api/getStickerPack'; | ||
|
||
export default function useGetStickerPack(bookId: number) { | ||
const { data: stickerPack } = useQuery( | ||
const navigate = useNavigate(); | ||
|
||
const { data: stickerPack, isLoading } = useQuery( | ||
['useGetStickerPack'], | ||
() => getStickerPack(bookId), | ||
{ | ||
onError: () => { | ||
console.error; | ||
navigate('/error'); | ||
}, | ||
}, | ||
); | ||
|
||
return { stickerPack }; | ||
return { stickerPack, isLoading }; | ||
} |
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
Oops, something went wrong.