20 lines
440 B
TypeScript
20 lines
440 B
TypeScript
import axios from 'axios'
|
|
|
|
const publicApiClient = axios.create({
|
|
baseURL: '/api',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
})
|
|
|
|
export interface ServerTimeResponse {
|
|
timestamp: number
|
|
iso: string
|
|
}
|
|
|
|
export const timeApi = {
|
|
getServerTime: async (): Promise<ServerTimeResponse> => {
|
|
const response = await publicApiClient.get<ServerTimeResponse>('/time')
|
|
return response.data
|
|
},
|
|
} |