Initial commit
This commit is contained in:
24
ts/streamToken.ts
Normal file
24
ts/streamToken.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user