decord/source/modules/auth_sessions/AuthSessionsUtils.tsx

49 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 13859
// Function ID: 13860
2026-07-20 16:05:17 +00:00
// Name: useAuthSessions
2026-08-05 07:35:12 +00:00
// Dependencies: [19, 1218, 13860, 589, 1236, 3837, 2]
2026-07-20 16:05:17 +00:00
// Exports: formatDate, useAuthSessions
2026-08-05 07:35:12 +00:00
// Module 13859 (useAuthSessions)
2026-07-29 08:29:29 +00:00
import noop from "noop";
import fetchFingerprint from "fetchFingerprint";
import handleInit from "handleInit";
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
const result = require("handleInit").fileFinishedImporting("modules/auth_sessions/AuthSessionsUtils.tsx");
2026-07-20 16:05:17 +00:00
export const useAuthSessions = function useAuthSessions() {
2026-07-29 08:29:29 +00:00
const items = [handleInit];
stateFromStoresObject = stateFromStoresObject(589).useStateFromStoresObject(items, () => sessions.getSessions());
2026-07-20 16:05:17 +00:00
const items1 = [stateFromStoresObject];
return React.useMemo(() => {
2026-07-29 08:29:29 +00:00
const otherSessions = [...authSessionIdHash];
2026-07-23 10:11:24 +00:00
authSessionIdHash = outer1_4.getAuthSessionIdHash();
2026-07-29 08:29:29 +00:00
let currentSession = null;
2026-07-20 16:05:17 +00:00
if (null != authSessionIdHash) {
2026-07-29 08:29:29 +00:00
const findIndexResult = otherSessions.findIndex((id_hash) => id_hash.id_hash === authSessionIdHash);
currentSession = null;
2026-07-20 16:05:17 +00:00
if (findIndexResult >= 0) {
2026-07-29 08:29:29 +00:00
currentSession = otherSessions.splice(findIndexResult, 1)[0];
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const sorted = otherSessions.sort((approx_last_used_time, approx_last_used_time2) => {
2026-07-20 16:05:17 +00:00
approx_last_used_time = approx_last_used_time2.approx_last_used_time;
approx_last_used_time2 = approx_last_used_time.approx_last_used_time;
return approx_last_used_time.valueOf() - approx_last_used_time2.valueOf();
});
2026-07-29 08:29:29 +00:00
return { currentSession, otherSessions };
2026-07-20 16:05:17 +00:00
}, items1);
};
export const formatDate = function formatDate(arg0) {
const timestamp = Date.now();
if ((timestamp - arg0.valueOf()) / 1000 / 60 / 60 < 1) {
2026-07-29 08:29:29 +00:00
const intl = require(1236) /* getSystemLocale */.intl;
let stringResult = intl.string(require(1236) /* getSystemLocale */.t.TXCmfL);
2026-07-20 16:05:17 +00:00
} else {
2026-08-05 07:35:12 +00:00
stringResult = importDefault(3837)(arg0).fromNow();
const obj = importDefault(3837)(arg0);
2026-07-20 16:05:17 +00:00
}
return stringResult;
};