Config saving behaviour change

This commit is contained in:
Sacha Weatherstone
2022-12-31 17:14:11 +11:00
parent f7fe27d621
commit ec25ec60ee
18 changed files with 227 additions and 103 deletions
+15 -2
View File
@@ -24,7 +24,7 @@ export interface SettingsPanelProps {
}
export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
const { connection } = useDevice();
const { connection, addChannel } = useDevice();
const [keySize, setKeySize] = useState<128 | 256>(256);
const [pskHidden, setPskHidden] = useState(true);
@@ -81,7 +81,20 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
}
}
})
.then(() => reset({ ...data })),
.then(() =>
addChannel({
config: {
index: channel.index,
role: channel.role,
settings: {
...data,
psk: toByteArray(data.psk ?? "")
}
},
lastInterraction: new Date(),
messages: []
})
),
{
loading: "Saving...",
success: "Saved Channel",