mirror of
https://github.com/1Panel-dev/CordysCRM.git
synced 2026-05-17 22:20:56 +08:00
13 lines
348 B
TypeScript
13 lines
348 B
TypeScript
export function joinTimestamp<T extends boolean>(join: boolean, restful: T): T extends true ? string : object;
|
|
|
|
export function joinTimestamp(join: boolean, restful = false): string | object {
|
|
if (!join) {
|
|
return restful ? '' : {};
|
|
}
|
|
const now = new Date().getTime();
|
|
if (restful) {
|
|
return `?_t=${now}`;
|
|
}
|
|
return { _t: now };
|
|
}
|