2
0

feat(editor): ️ Show Google Sheets detail

This commit is contained in:
Baptiste Arnaud
2022-04-11 12:59:00 -05:00
parent 18206866b8
commit 4a2c6627c3
6 changed files with 44 additions and 53 deletions

View File

@ -8,13 +8,13 @@ export const useCredentials = ({
onError,
}: {
userId?: string
onError: (error: Error) => void
onError?: (error: Error) => void
}) => {
const { data, error, mutate } = useSWR<{ credentials: Credentials[] }, Error>(
userId ? `/api/users/${userId}/credentials` : null,
fetcher
)
if (error) onError(error)
if (error && onError) onError(error)
return {
credentials: data?.credentials ?? [],
isLoading: !error && !data,