-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d8f1d9
commit be3428d
Showing
3 changed files
with
53 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import 'server-only'; | ||
export const dynamic = 'force-dynamic'; | ||
|
||
import client from '../../../../lib/appwrite_client'; | ||
import { Databases } from 'appwrite'; | ||
|
||
import { NextResponse } from 'next/server'; | ||
|
||
const databases = new Databases(client); | ||
|
||
export async function GET() { | ||
const response = await databases.listDocuments( | ||
process.env.APPWRITE_DATABASE_ID as string, | ||
'peoples' | ||
); | ||
|
||
return NextResponse.json(response); | ||
} | ||
import 'server-only'; | ||
export const dynamic = 'force-dynamic'; | ||
|
||
import client from '../../../../lib/appwrite_client'; | ||
import { Databases } from 'appwrite'; | ||
|
||
import { NextResponse } from 'next/server'; | ||
|
||
const databases = new Databases(client); | ||
|
||
export async function GET() { | ||
const response = await databases.listDocuments( | ||
process.env.APPWRITE_DATABASE_ID as string, | ||
'peoples' | ||
); | ||
|
||
return NextResponse.json(response); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import client from '../../../../lib/appwrite_client'; | ||
import { Storage } from 'appwrite'; | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
|
||
const storage = new Storage(client); | ||
|
||
export async function GET(request: NextRequest) { | ||
const searchParams = request.nextUrl.searchParams; | ||
const queryParam = searchParams.get('name'); | ||
|
||
const imageResponse = await storage.getFilePreview( | ||
process.env.APPWRITE_STORAGE_BUCKET_ID as string, | ||
queryParam as string | ||
); | ||
|
||
const image = await fetch(imageResponse.href, { cache: 'no-store' }); | ||
const blob = await image.blob(); | ||
|
||
const headers = new Headers(); | ||
headers.set('Content-Type', 'image/*'); | ||
|
||
return new NextResponse(blob, { status: 200, statusText: 'OK', headers }); | ||
} | ||
import client from '../../../../lib/appwrite_client'; | ||
import { Storage } from 'appwrite'; | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
|
||
const storage = new Storage(client); | ||
|
||
export async function GET(request: NextRequest) { | ||
const searchParams = request.nextUrl.searchParams; | ||
const queryParam = searchParams.get('name'); | ||
|
||
const imageResponse = await storage.getFilePreview( | ||
process.env.APPWRITE_STORAGE_BUCKET_ID as string, | ||
queryParam as string | ||
); | ||
|
||
const image = await fetch(imageResponse.href, { cache: 'no-store' }); | ||
const blob = await image.blob(); | ||
|
||
const headers = new Headers(); | ||
headers.set('Content-Type', 'image/*'); | ||
|
||
return new NextResponse(blob, { status: 200, statusText: 'OK', headers }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import { QueryClientProvider, QueryClient } from '@tanstack/react-query'; | ||
|
||
export default function ReactQueryProvider({ | ||
children, | ||
}: React.PropsWithChildren) { | ||
const [client] = React.useState(new QueryClient()); | ||
|
||
return <QueryClientProvider client={client}>{children}</QueryClientProvider>; | ||
} | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import { QueryClientProvider, QueryClient } from '@tanstack/react-query'; | ||
|
||
export default function ReactQueryProvider({ | ||
children, | ||
}: React.PropsWithChildren) { | ||
const [client] = React.useState(new QueryClient()); | ||
|
||
return <QueryClientProvider client={client}>{children}</QueryClientProvider>; | ||
} |