mirror of
https://github.com/owncast/owncast.git
synced 2024-12-18 15:23:55 +03:00
b38df2fbe3
* Inject services with useContext * Extract service for video settings * Create mock factories for services * Create test data for chat history * Add story to visualize different layouts * Fix renaming mistake * Add landscape and portrait viewports * Add landscape stories --------- Co-authored-by: Gabe Kangas <gabek@real-ity.com>
19 lines
531 B
TypeScript
19 lines
531 B
TypeScript
import { createContext } from 'react';
|
|
import { ServerStatus } from '../interfaces/server-status.model';
|
|
|
|
const ENDPOINT = `/api/status`;
|
|
|
|
export interface ServerStatusStaticService {
|
|
getStatus(): Promise<ServerStatus>;
|
|
}
|
|
|
|
class ServerStatusService {
|
|
public static async getStatus(): Promise<ServerStatus> {
|
|
const response = await fetch(ENDPOINT);
|
|
const status = await response.json();
|
|
return status;
|
|
}
|
|
}
|
|
|
|
export const ServerStatusServiceContext =
|
|
createContext<ServerStatusStaticService>(ServerStatusService);
|