configure board source in typescript
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { boardConfig } from "../../../board.config";
|
||||
|
||||
type GithubContent = {
|
||||
name: string;
|
||||
@@ -68,12 +69,10 @@ async function fetchDirectory(owner: string, repo: string, path: string, branch?
|
||||
};
|
||||
}
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const repoValue = searchParams.get("repo") || process.env.NEXT_PUBLIC_GITHUB_REPO || null;
|
||||
const branch = searchParams.get("branch") || process.env.NEXT_PUBLIC_GITHUB_BRANCH || undefined;
|
||||
const path = searchParams.get("path") || process.env.NEXT_PUBLIC_GITHUB_PHOTOS_PATH || "";
|
||||
const parsedRepo = parseRepo(repoValue);
|
||||
export async function GET() {
|
||||
const branch = boardConfig.branch || undefined;
|
||||
const path = boardConfig.photosPath;
|
||||
const parsedRepo = parseRepo(boardConfig.repo);
|
||||
|
||||
if (!parsedRepo) {
|
||||
return NextResponse.json({
|
||||
|
||||
Reference in New Issue
Block a user