good forst commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { apiFetch, jsonResponse } from '../../../_lib/api';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function DELETE(
|
||||
_req: Request,
|
||||
{ params }: { params: Promise<{ id: string }> },
|
||||
): Promise<Response> {
|
||||
const { id } = await params;
|
||||
const res = await apiFetch(`/admin/bot/${id}`, { method: 'DELETE' });
|
||||
const payload = await res.json().catch(() => ({}));
|
||||
return jsonResponse(payload, res.status);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { apiFetch, jsonResponse } from '../../../_lib/api';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function POST(req: Request): Promise<Response> {
|
||||
const body = await req.json();
|
||||
const res = await apiFetch('/admin/bot/attach', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
}).catch(() => null);
|
||||
if (!res) return jsonResponse({ message: 'Upstream unavailable' }, 502);
|
||||
const payload = await res.json();
|
||||
return jsonResponse(payload, res.status);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { getApiBaseUrl, getToken, jsonResponse } from '../../../_lib/api';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function POST(req: Request): Promise<Response> {
|
||||
const body = await req.json().catch(() => ({}));
|
||||
const token = await getToken();
|
||||
const res = await fetch(`${getApiBaseUrl()}/admin/bot/initiate`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
cache: 'no-store',
|
||||
});
|
||||
const payload = await res.json();
|
||||
return jsonResponse(payload, res.status);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { apiFetch, jsonResponse } from '../../../../_lib/api';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function GET(
|
||||
_req: Request,
|
||||
{ params }: { params: Promise<{ token: string }> },
|
||||
): Promise<Response> {
|
||||
const { token } = await params;
|
||||
const res = await apiFetch(`/admin/bot/qr/${token}`);
|
||||
const payload = await res.json();
|
||||
return jsonResponse(payload, res.status);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { getApiBaseUrl, getToken, jsonResponse } from '../../../_lib/api';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function POST(): Promise<Response> {
|
||||
const token = await getToken();
|
||||
const res = await fetch(`${getApiBaseUrl()}/admin/bot/reveal`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
||||
},
|
||||
cache: 'no-store',
|
||||
});
|
||||
const payload = await res.json();
|
||||
return jsonResponse(payload, res.status);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { apiFetch, jsonResponse } from '../../_lib/api';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function GET(): Promise<Response> {
|
||||
const res = await apiFetch('/admin/bot').catch(() => null);
|
||||
if (!res) return jsonResponse({ message: 'Upstream unavailable' }, 502);
|
||||
const body = await res.json();
|
||||
return jsonResponse(body, res.status);
|
||||
}
|
||||
Reference in New Issue
Block a user