refactor: timestamp
This commit is contained in:
@@ -76,7 +76,7 @@ function Send({
|
||||
for await (const msg of msgs) {
|
||||
console.log("send msg", msg);
|
||||
const { type: content_type, content, properties = {} } = msg;
|
||||
properties.local_id = properties.local_id ?? new Date().getTime();
|
||||
properties.local_id = properties.local_id ?? +new Date();
|
||||
await sendMessage({
|
||||
id,
|
||||
reply_mid: replying_mid,
|
||||
@@ -90,7 +90,7 @@ function Send({
|
||||
// send files
|
||||
if (uploadFiles && uploadFiles.length !== 0) {
|
||||
uploadFiles.forEach((fileInfo) => {
|
||||
const ts = new Date().getTime();
|
||||
const ts = +new Date();
|
||||
const { url, name, size, type } = fileInfo;
|
||||
const tmpMsg = {
|
||||
mid: ts,
|
||||
@@ -118,7 +118,7 @@ function Send({
|
||||
type: "markdown",
|
||||
content,
|
||||
from_uid,
|
||||
properties: { local_id: new Date().getTime() },
|
||||
properties: { local_id: +new Date() },
|
||||
});
|
||||
};
|
||||
const toggleMode = () => {
|
||||
|
||||
@@ -64,7 +64,7 @@ export default function useStreaming() {
|
||||
if (initialized || initializing) return;
|
||||
// 如果token快要过期,先renew
|
||||
const {
|
||||
authData: { token, expireTime = new Date().getTime(), refreshToken },
|
||||
authData: { token, expireTime = +new Date(), refreshToken },
|
||||
} = store.getState();
|
||||
let api_token = token;
|
||||
const tokenAlmostExpire = dayjs().isAfter(new Date(expireTime - 20 * 1000));
|
||||
|
||||
@@ -44,7 +44,7 @@ export default function useUploadFile(props = {}) {
|
||||
if (!file) return;
|
||||
setData(null);
|
||||
const {
|
||||
name = `rustchat-${new Date().getTime()}.${file.type.split("/")[1]}`,
|
||||
name = `rustchat-${+new Date()}.${file.type.split("/")[1]}`,
|
||||
type: file_type,
|
||||
size: file_size,
|
||||
} = file;
|
||||
|
||||
Reference in New Issue
Block a user