ability to remove apikey from storage

This commit is contained in:
2025-07-28 16:21:57 +03:00
parent 4766d15396
commit ac128e32f9

View File

@@ -1102,6 +1102,53 @@ export const NotAuthenticated = ({
onChange={handleFileChangeApiKey} // File input handler
/>
</Button>
{(apiKey || importedApiKey) && (
<Button
disabled={!!enteredApiKey}
variant="contained"
component="label"
onClick={() => {
setImportedApiKey(null);
setCustomNodes((prev) => {
const copyPrev = [...prev];
const findLocalIndex = copyPrev?.findIndex(
(item) => item?.url === 'http://127.0.0.1:12391'
);
if (findLocalIndex === -1) {
copyPrev.unshift({
url: 'http://127.0.0.1:12391',
apikey: '',
});
} else {
copyPrev[findLocalIndex] = {
url: 'http://127.0.0.1:12391',
apikey: '',
};
}
window
.sendMessage('setCustomNodes', copyPrev)
.catch((error) => {
console.error(
'Failed to set custom nodes:',
error.message ||
t('core:message.error.generic', {
postProcess: 'capitalizeFirstChar',
})
);
});
return copyPrev;
});
setCurrentNode({
url: 'http://127.0.0.1:12391',
});
setUseLocalNode(false);
}}
>
{t('core:action.remove', {
postProcess: 'capitalizeFirstChar',
})}
</Button>
)}
</Box>
</DialogContent>