-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ew * ew, changing direction gonna keep ~some~ of zustand * good enough
- Loading branch information
1 parent
5ddaebf
commit f309c15
Showing
17 changed files
with
199 additions
and
205 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
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
13 changes: 7 additions & 6 deletions
13
apps/client/src/components/Settings/General/ProfileForm.tsx
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Library, PageInfo } from '@stump/core'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { AxiosError } from 'axios'; | ||
import { useMemo } from 'react'; | ||
import { getLibraries } from '~api/library'; | ||
|
||
export function useLibraries() { | ||
const { data, ...rest } = useQuery(['getLibraries'], getLibraries, { | ||
// Send all non-401 errors to the error page | ||
useErrorBoundary: (err: AxiosError) => !err || (err.response?.status ?? 500) !== 401, | ||
}); | ||
|
||
const { libraries, pageData } = useMemo<{ libraries: Library[]; pageData?: PageInfo }>(() => { | ||
if (data?.data) { | ||
return { | ||
libraries: data.data.data, | ||
pageData: data.data._page, | ||
}; | ||
} | ||
|
||
return { libraries: [] }; | ||
}, [data]); | ||
|
||
console.log({ libraries }); | ||
|
||
return { | ||
libraries, | ||
pageData, | ||
...rest, | ||
}; | ||
} |
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 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
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
Oops, something went wrong.