Skip to content

Commit

Permalink
disable caching, fix length, remote route
Browse files Browse the repository at this point in the history
  • Loading branch information
docimin committed Jun 24, 2024
1 parent f9c050e commit b207e6b
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default async function FollowerPage({
})
)

if (!followerData) {
if (followerData.length === 0) {
return (
<PageLayout title={'Friends'}>
<div className={'flex flex-1 justify-center items-center h-full'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default async function FollowingPage({
})
)

if (!followingData) {
if (followingData.length === 0) {
return (
<PageLayout title={'Following'}>
<div className={'flex flex-1 justify-center items-center h-full'}>
Expand Down
14 changes: 0 additions & 14 deletions src/app/api/user/listTeams/route.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/utils/server-api/followers/getFollowers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createSessionServerClient } from '@/app/appwrite-session'
import { Followers } from '@/utils/types/models'
import { Query } from 'node-appwrite'
import { unstable_noStore } from 'next/cache'

/**
* This function is used to get the followers of a user.
Expand All @@ -12,6 +13,7 @@ import { Query } from 'node-appwrite'
export async function getFollowers(
userId: string
): Promise<Followers.FollowerType> {
unstable_noStore()
const { databases } = await createSessionServerClient()
return await databases
.listDocuments('hp_db', 'followers', [Query.equal('followerId', userId)])
Expand Down
2 changes: 2 additions & 0 deletions src/utils/server-api/followers/getFollowing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createSessionServerClient } from '@/app/appwrite-session'
import { Followers } from '@/utils/types/models'
import { Query } from 'node-appwrite'
import { unstable_noStore } from 'next/cache'

/**
* This function is used to get the following users of a user.
Expand All @@ -12,6 +13,7 @@ import { Query } from 'node-appwrite'
export async function getFollowing(
userId: string
): Promise<Followers.FollowerType> {
unstable_noStore()
const { databases } = await createSessionServerClient()
return await databases
.listDocuments('hp_db', 'followers', [Query.equal('userId', userId)])
Expand Down
2 changes: 2 additions & 0 deletions src/utils/server-api/interactive/votes/getQuestionId.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createAdminClient } from '@/app/appwrite-session'
import { Interactive } from '@/utils/types/models'
import { unstable_noStore } from 'next/cache'

/**
* This function is used to get the answers of the votes of Lighthase's EF Panel.
Expand All @@ -8,6 +9,7 @@ import { Interactive } from '@/utils/types/models'
* const questionId = await getQuestionId()
*/
export async function getQuestionId(): Promise<number> {
unstable_noStore()
const { databases } = await createAdminClient()
const data: Interactive.VotesQuestionId = await databases
.getDocument('interactive', 'questions', 'main')
Expand Down
2 changes: 2 additions & 0 deletions src/utils/server-api/interactive/votes/getVotes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createAdminClient } from '@/app/appwrite-session'
import { Interactive } from '@/utils/types/models'
import { unstable_noStore } from 'next/cache'

/**
* This function is used to get the answers of the votes of Lighthase's EF Panel.
Expand All @@ -8,6 +9,7 @@ import { Interactive } from '@/utils/types/models'
* const votes = await getVotes()
*/
export async function getVotes(): Promise<Interactive.VotesAnswersType> {
unstable_noStore()
const { databases } = await createAdminClient()
return await databases
.listDocuments('interactive', 'answers')
Expand Down
2 changes: 2 additions & 0 deletions src/utils/server-api/system/getSessionCookie.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use server'
import { headers } from 'next/headers'
import { unstable_noStore } from 'next/cache'

/**
* This function is used to get the cookies from the request headers.
Expand All @@ -11,6 +12,7 @@ import { headers } from 'next/headers'
* console.log(sessionCookie)
*/
async function getSessionCookie() {

Check warning on line 14 in src/utils/server-api/system/getSessionCookie.ts

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused local symbol

Unused function getSessionCookie
unstable_noStore()
const headersList = headers()
const cookieHeader = headersList.get('cookie')
const cookies = cookieHeader ? cookieHeader.split('; ') : []
Expand Down

0 comments on commit b207e6b

Please sign in to comment.