File tree 2 files changed +8
-21
lines changed 2 files changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ import {
25
25
import { User } from 'src/pages/members'
26
26
import AppNavBar from './AppNavBar'
27
27
import AppFooter from './AppFooter'
28
- import { useRouter } from 'next/router'
29
28
import useFollowUser from './profile/useFollowUser'
30
29
31
30
type LikeData = {
@@ -267,10 +266,7 @@ export default function HomePageFeed({
267
266
}
268
267
269
268
function HomePageSideNavBar ( ) {
270
- const [ session , loading ] = useSession ( )
271
- if ( loading ) {
272
- return < p > loading...</ p >
273
- }
269
+ const [ session ] = useSession ( )
274
270
return (
275
271
< >
276
272
< nav
@@ -391,18 +387,13 @@ function FollowButton({ user }: { user: User }) {
391
387
}
392
388
393
389
function HomePageAside ( { updates } : { updates : HomePageFeedUpdateType [ ] } ) {
394
- const router = useRouter ( )
395
- const [ session , loading ] = useSession ( )
390
+ const [ session ] = useSession ( )
396
391
const { isLoading, isError, data : response } = useQuery (
397
392
'api/fauna/who-to-follow' ,
398
393
( ) => {
399
394
return fetch ( `/api/fauna/who-to-follow` ) . then ( ( res ) => res . json ( ) )
400
395
}
401
396
)
402
- if ( loading ) {
403
- return < p > loading...</ p >
404
- }
405
- console . log ( { response } )
406
397
407
398
return (
408
399
< >
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export type HomePageFeedUpdateType = {
25
25
}
26
26
27
27
export default function Home ( ) {
28
- const [ session , loading ] = useSession ( )
28
+ const [ session ] = useSession ( )
29
29
30
30
const { isLoading, isError, data } = useQuery ( '/api/fauna/all-updates' , ( ) =>
31
31
fetch ( `/api/fauna/all-updates` ) . then ( ( res ) => {
@@ -49,22 +49,18 @@ export default function Home() {
49
49
} )
50
50
} )
51
51
52
- if ( loading || isLoading || isGoalLoading ) {
53
- return < p > loading...</ p >
54
- }
55
-
56
52
if ( isError || isGoalError ) {
57
53
return < p > Something went wrong!!!</ p >
58
54
}
59
55
60
- const updates = data . updates . data
61
-
62
56
return (
63
57
< >
64
58
< HomePageFeed
65
- updates = { updates }
66
- showGoal = { Boolean ( session && goalData ?. goal ) }
67
- goal = { goalData . goal }
59
+ updates = { isLoading ? [ ] : data . updates . data }
60
+ showGoal = { Boolean (
61
+ ! isGoalLoading && ! isGoalError && session && goalData ?. goal
62
+ ) }
63
+ goal = { goalData ?. goal }
68
64
/>
69
65
</ >
70
66
)
You can’t perform that action at this time.
0 commit comments