hezarfen_frontend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import { client } from "@/api/client"; |
| 2 | |
| 3 | let pendingTimePromise: Promise<{ now: number }> | null = null; |
| 4 | |
| 5 | export async function getTime(signal?: AbortSignal): Promise<{ now: number }> { |
| 6 | if (pendingTimePromise) return pendingTimePromise; |
| 7 | pendingTimePromise = client<{ now: number }>("/time", { signal, cache: "no-store" }).finally(() => { |
| 8 | pendingTimePromise = null; |
| 9 | }); |
| 10 | return pendingTimePromise; |
| 11 | } |