34 lines
No EOL
1 KiB
TypeScript
34 lines
No EOL
1 KiB
TypeScript
import {useIpStore} from "../../ipStore";
|
|
import {NetworkService} from "../../../api/request";
|
|
|
|
const createNetworkSettings = () => {
|
|
const { ipAddress } = useIpStore.getState();
|
|
|
|
return [
|
|
{
|
|
id: 'clean-network',
|
|
type: 'button',
|
|
label: 'Очистить данные сессии',
|
|
sectionId: 'Точки доступа',
|
|
defaultValue: 'Очистить',
|
|
action: async ()=>{
|
|
try {
|
|
const res = await NetworkService.clearNetwork(ipAddress);
|
|
console.log(res);
|
|
}catch (e){
|
|
console.error(e);
|
|
alert('Данные не были удалены: '+ e)
|
|
}
|
|
},
|
|
},
|
|
{
|
|
id: 'export-network',
|
|
type: 'button',
|
|
label: 'Экспорт данных точек доступа',
|
|
sectionId: 'Точки доступа',
|
|
defaultValue: 'Экспортировать',
|
|
},
|
|
] as const;
|
|
};
|
|
|
|
export const networkSettings = createNetworkSettings(); |