mirror of
https://github.com/crypto-pro-web/crypto-pro-js.git
synced 2025-04-18 19:43:12 +03:00
37 lines
813 B
JavaScript
37 lines
813 B
JavaScript
import React, { useState, useEffect } from 'react';
|
||
import { getSystemInfo, isValidSystemSetup } from 'crypto-pro';
|
||
|
||
function SystemInfo() {
|
||
const [systemInfo, setSystemInfo] = useState(null);
|
||
const [systemInfoError, setSystemInfoError] = useState(null);
|
||
|
||
useEffect(() => {
|
||
(async () => {
|
||
try {
|
||
setSystemInfo({
|
||
...await getSystemInfo(),
|
||
isValidSystemSetup: await isValidSystemSetup()
|
||
});
|
||
} catch (error) {
|
||
setSystemInfoError(error.message);
|
||
}
|
||
})();
|
||
});
|
||
|
||
return (
|
||
<>
|
||
<legend>Информация о системе</legend>
|
||
|
||
<pre>
|
||
{systemInfo ? (
|
||
JSON.stringify(systemInfo, null, ' ')
|
||
) : (
|
||
systemInfoError || null
|
||
)}
|
||
</pre>
|
||
</>
|
||
);
|
||
}
|
||
|
||
export default SystemInfo;
|