You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
531 B
19 lines
531 B
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);
|
|
|