mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-07-29 21:21:24 +00:00
ability to remove apikey from storage
This commit is contained in:
@@ -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>
|
||||
|
||||
|
Reference in New Issue
Block a user