mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-09 22:21:49 +02:00
UI refresh (#476)
This commit is contained in:
parent
e6a13c235d
commit
bba880ff4c
53 changed files with 1198 additions and 1014 deletions
|
@ -52,11 +52,15 @@ export const UserProvider = (props: { children?: React.ReactNode }) => {
|
|||
const { t } = useTranslation("app");
|
||||
|
||||
const queryClient = trpcNext.useContext();
|
||||
const { data: user, isFetching } = trpcNext.whoami.get.useQuery();
|
||||
const { data: user } = trpcNext.whoami.get.useQuery();
|
||||
|
||||
const [isUpdating, setIsUpdating] = React.useState(false);
|
||||
|
||||
const logout = trpcNext.whoami.destroy.useMutation({
|
||||
onSuccess: () => {
|
||||
queryClient.whoami.invalidate();
|
||||
onSuccess: async () => {
|
||||
setIsUpdating(true);
|
||||
await queryClient.whoami.invalidate();
|
||||
setIsUpdating(false);
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -96,7 +100,7 @@ export const UserProvider = (props: { children?: React.ReactNode }) => {
|
|||
return (
|
||||
<UserContext.Provider
|
||||
value={{
|
||||
isUpdating: isFetching,
|
||||
isUpdating,
|
||||
user: { ...user, shortName },
|
||||
refresh: () => {
|
||||
return queryClient.whoami.invalidate();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue