mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-08 13:41:51 +02:00
Change user update indicator (#450)
This commit is contained in:
parent
0628ce5971
commit
e21574b032
2 changed files with 16 additions and 7 deletions
|
@ -12,6 +12,7 @@ export const UserContext =
|
|||
React.createContext<{
|
||||
user: UserSession & { shortName: string };
|
||||
refresh: () => void;
|
||||
isUpdating: boolean;
|
||||
logout: () => void;
|
||||
ownsObject: (obj: { userId: string | null }) => boolean;
|
||||
} | null>(null);
|
||||
|
@ -82,9 +83,7 @@ export const UserProvider = (props: { children?: React.ReactNode }) => {
|
|||
});
|
||||
});
|
||||
|
||||
const shortName = isFetching
|
||||
? t("loading")
|
||||
: user
|
||||
const shortName = user
|
||||
? user.isGuest === false
|
||||
? user.name
|
||||
: user.id.substring(0, 10)
|
||||
|
@ -97,6 +96,7 @@ export const UserProvider = (props: { children?: React.ReactNode }) => {
|
|||
return (
|
||||
<UserContext.Provider
|
||||
value={{
|
||||
isUpdating: isFetching,
|
||||
user: { ...user, shortName },
|
||||
refresh: () => {
|
||||
return queryClient.whoami.invalidate();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue