fix: add worker, create cluster
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { querySystemConfig } from '../apis';
|
||||
import { SystemConfig } from '../config/types';
|
||||
|
||||
export default function useSystemConfig() {
|
||||
const [systemConfig, setSystemConfig] = useState<SystemConfig>(
|
||||
{} as SystemConfig
|
||||
);
|
||||
|
||||
const fetchSystemConfig = async () => {
|
||||
try {
|
||||
const data = await querySystemConfig();
|
||||
setSystemConfig(data);
|
||||
} catch (error) {
|
||||
// handle error if needed
|
||||
setSystemConfig({} as SystemConfig);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchSystemConfig();
|
||||
}, []);
|
||||
|
||||
return { systemConfig };
|
||||
}
|
||||
Reference in New Issue
Block a user