25 lines
503 B
TypeScript
25 lines
503 B
TypeScript
import { BambuddyAddress } from './constants';
|
|
|
|
export async function getStreamToken(
|
|
bearerToken: string,
|
|
): Promise<PrinterDetails | null> {
|
|
const request = await fetch(
|
|
`${BambuddyAddress}/api/v1/printers/camera/stream-token`,
|
|
{
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
Authorization: `Bearer ${bearerToken}`,
|
|
},
|
|
method: 'POST',
|
|
},
|
|
);
|
|
|
|
const response = await request.json();
|
|
|
|
return response as PrinterDetails;
|
|
}
|
|
|
|
export interface PrinterDetails {
|
|
token: string;
|
|
}
|