File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -43,10 +43,32 @@ export function useAuth() {
4343 // Only fetch user data if we have a token AND we're not on the callback page
4444 const { isAuthReady } = useAuthReady ( )
4545
46- const { data } = useGetMeQuery ( {
46+ const { data, fetching } = useGetMeQuery ( {
4747 pause : computed ( ( ) => ! isAuthReady . value ) ,
4848 } )
4949
50+ // If we already have user data, mark as not loading
51+ if ( me . value ) {
52+ isLoading . value = false
53+ }
54+
55+ // If we don't have a token, we're not loading (we're just not authenticated)
56+ if ( ! token . value ) {
57+ isLoading . value = false
58+ }
59+
60+ // Update loading state: we're done loading when query is not fetching
61+ // This handles both completed queries and paused queries
62+ watch (
63+ fetching ,
64+ ( isFetching ) => {
65+ if ( ! isFetching ) {
66+ isLoading . value = false
67+ }
68+ } ,
69+ { immediate : true } ,
70+ )
71+
5072 watch (
5173 ( ) => data . value ?. me ,
5274 ( newMe ) => {
You can’t perform that action at this time.
0 commit comments