27 lines
667 B
TypeScript
27 lines
667 B
TypeScript
|
"use server";
|
||
|
|
||
|
import { cookies } from "next/headers";
|
||
|
|
||
|
export async function listLives(): Promise<any[]> {
|
||
|
const token = cookies().get("token");
|
||
|
const params = new URLSearchParams();
|
||
|
params.append("pageSize", "99999");
|
||
|
const lives = await fetch(
|
||
|
"https://tachy.daoyoucloud.com/api/lives:list?" + params.toString(),
|
||
|
{
|
||
|
method: "GET",
|
||
|
headers: {
|
||
|
"X-App": "danmu-sim",
|
||
|
"X-Authenticator": "basic",
|
||
|
authorization: "Bearer " + token?.value,
|
||
|
"content-type": "application/json",
|
||
|
},
|
||
|
next: {
|
||
|
tags: ["lives"],
|
||
|
},
|
||
|
}
|
||
|
);
|
||
|
const result = await lives.json();
|
||
|
return result?.data ?? [];
|
||
|
}
|