Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelmala committed Aug 23, 2024
1 parent 9b40bab commit fd69578
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
6 changes: 4 additions & 2 deletions src/api/agileLive/ingest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
} from '../../../types/agile-live';
import { AGILE_BASE_API_PATH } from '../../constants';
import { getAuthorizationHeader } from './utils/authheader';
import { ResourcesSourceResponse } from '../../../types/agile-live';

// TODO: create proper cache...
const INGEST_UUID_CACHE: Map<string, string> = new Map();
Expand Down Expand Up @@ -131,7 +130,10 @@ export async function getSourceThumbnail(

export async function getIngestSources(uuid: string) {
const response = await fetch(
new URL(AGILE_BASE_API_PATH + `/ingests/${uuid}/sources?expand=true`, process.env.AGILE_URL),
new URL(
AGILE_BASE_API_PATH + `/ingests/${uuid}/sources?expand=true`,
process.env.AGILE_URL
),
{
headers: {
authorization: getAuthorizationHeader()
Expand Down
21 changes: 12 additions & 9 deletions src/app/api/manager/sources/resources/[id]/route.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import { NextResponse, NextRequest } from "next/server";
import { getIngestSources } from "../../../../../../api/agileLive/ingest";
import { isAuthenticated } from "../../../../../../api/manager/auth";
import { NextResponse, NextRequest } from 'next/server';
import { getIngestSources } from '../../../../../../api/agileLive/ingest';
import { isAuthenticated } from '../../../../../../api/manager/auth';

type Params = {
id: string;
};

export async function GET(request: NextRequest, { params }: { params: Params }): Promise<NextResponse> {
export async function GET(
request: NextRequest,
{ params }: { params: Params }
): Promise<NextResponse> {
if (!(await isAuthenticated())) {
return new NextResponse(`Not Authorized!`, {
status: 403
});
}
return new NextResponse(`Not Authorized!`, {
status: 403
});
}

try {
return NextResponse.json(await getIngestSources(params.id));
} catch (e) {
Expand Down
19 changes: 9 additions & 10 deletions src/app/api/manager/sources/resources/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import { NextResponse } from 'next/server';
import { isAuthenticated } from '../../../../../api/manager/auth';
import { getIngests } from '../../../../../api/agileLive/ingest';


export async function GET(): Promise<NextResponse> {
if (!(await isAuthenticated())) {
return new NextResponse(`Not Authorized!`, {
status: 403
});
}
return new NextResponse(`Not Authorized!`, {
status: 403
});
}

try {
return NextResponse.json(await getIngests());
} catch (e) {
return new NextResponse(e?.toString(), { status: 404 })
}
return NextResponse.json(await getIngests());
} catch (e) {
return new NextResponse(e?.toString(), { status: 404 });
}
}

0 comments on commit fd69578

Please sign in to comment.