decord/source/modules/auth_sessions/AuthSessionsUtils.tsx

50 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 13638
// Function ID: 104745
2026-07-20 16:05:17 +00:00
// Name: useAuthSessions
2026-07-23 10:11:24 +00:00
// Dependencies: [31, 1194, 13639, 566, 1212, 3712, 2]
2026-07-20 16:05:17 +00:00
// Exports: formatDate, useAuthSessions
2026-07-23 10:11:24 +00:00
// Module 13638 (useAuthSessions)
import result from "result";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
const require = arg1;
const result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/auth_sessions/AuthSessionsUtils.tsx");
2026-07-20 16:05:17 +00:00
export const useAuthSessions = function useAuthSessions() {
2026-07-23 10:11:24 +00:00
let items = [closure_5];
stateFromStoresObject = stateFromStoresObject(566).useStateFromStoresObject(items, () => outer1_5.getSessions());
2026-07-20 16:05:17 +00:00
const items1 = [stateFromStoresObject];
return React.useMemo(() => {
2026-07-23 10:11:24 +00:00
const items = [...authSessionIdHash];
authSessionIdHash = outer1_4.getAuthSessionIdHash();
2026-07-20 16:05:17 +00:00
let first = null;
if (null != authSessionIdHash) {
const findIndexResult = items.findIndex((id_hash) => id_hash.id_hash === authSessionIdHash);
first = null;
if (findIndexResult >= 0) {
first = items.splice(findIndexResult, 1)[0];
}
}
const sorted = items.sort((approx_last_used_time, approx_last_used_time2) => {
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();
});
const obj = { currentSession: first, otherSessions: items };
return obj;
}, items1);
};
export const formatDate = function formatDate(arg0) {
const timestamp = Date.now();
if ((timestamp - arg0.valueOf()) / 1000 / 60 / 60 < 1) {
2026-07-23 10:11:24 +00:00
const intl = require(1212) /* getSystemLocale */.intl;
let stringResult = intl.string(require(1212) /* getSystemLocale */.t.TXCmfL);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
stringResult = importDefault(3712)(arg0).fromNow();
const obj = importDefault(3712)(arg0);
2026-07-20 16:05:17 +00:00
}
return stringResult;
};