chore: initial commit
This commit is contained in:
12
frontend/packages/lib-shared/api/http/helper.ts
Normal file
12
frontend/packages/lib-shared/api/http/helper.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
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 };
|
||||
}
|
||||
Reference in New Issue
Block a user