mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-23 19:37:52 +00:00
fixes
This commit is contained in:
parent
7222a082e0
commit
cbdb28c5d5
@ -74,7 +74,7 @@ export const NotAuthenticated = ({
|
|||||||
// });
|
// });
|
||||||
const [importedApiKey, setImportedApiKey] = React.useState(null);
|
const [importedApiKey, setImportedApiKey] = React.useState(null);
|
||||||
//add and edit states
|
//add and edit states
|
||||||
const [url, setUrl] = React.useState("http://");
|
const [url, setUrl] = React.useState("https://");
|
||||||
const [customApikey, setCustomApiKey] = React.useState("");
|
const [customApikey, setCustomApiKey] = React.useState("");
|
||||||
const [customNodeToSaveIndex, setCustomNodeToSaveIndex] =
|
const [customNodeToSaveIndex, setCustomNodeToSaveIndex] =
|
||||||
React.useState(null);
|
React.useState(null);
|
||||||
@ -348,15 +348,14 @@ export const NotAuthenticated = ({
|
|||||||
const addCustomNode = () => {
|
const addCustomNode = () => {
|
||||||
setMode("add-node");
|
setMode("add-node");
|
||||||
};
|
};
|
||||||
|
const saveCustomNodes = (myNodes, isFullListOfNodes) => {
|
||||||
const saveCustomNodes = (myNodes) => {
|
|
||||||
let nodes = [...(myNodes || [])];
|
let nodes = [...(myNodes || [])];
|
||||||
if (customNodeToSaveIndex !== null) {
|
if (!isFullListOfNodes && customNodeToSaveIndex !== null) {
|
||||||
nodes.splice(customNodeToSaveIndex, 1, {
|
nodes.splice(customNodeToSaveIndex, 1, {
|
||||||
url: removeTrailingSlash(url),
|
url: removeTrailingSlash(url),
|
||||||
apikey: customApikey,
|
apikey: customApikey,
|
||||||
});
|
});
|
||||||
} else if (url) {
|
} else if (!isFullListOfNodes && url) {
|
||||||
nodes.push({
|
nodes.push({
|
||||||
url: removeTrailingSlash(url),
|
url: removeTrailingSlash(url),
|
||||||
apikey: customApikey,
|
apikey: customApikey,
|
||||||
@ -372,7 +371,7 @@ export const NotAuthenticated = ({
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response) {
|
if (response) {
|
||||||
setMode("list");
|
setMode("list");
|
||||||
setUrl("http://");
|
setUrl("https://");
|
||||||
setCustomApiKey("");
|
setCustomApiKey("");
|
||||||
if(window?.electronAPI?.setAllowedDomains){
|
if(window?.electronAPI?.setAllowedDomains){
|
||||||
window.electronAPI.setAllowedDomains(nodes?.map((node) => node.url))
|
window.electronAPI.setAllowedDomains(nodes?.map((node) => node.url))
|
||||||
@ -776,7 +775,7 @@ export const NotAuthenticated = ({
|
|||||||
...(customNodes || []),
|
...(customNodes || []),
|
||||||
].filter((item) => item?.url !== node?.url);
|
].filter((item) => item?.url !== node?.url);
|
||||||
|
|
||||||
saveCustomNodes(nodesToSave);
|
saveCustomNodes(nodesToSave, true);
|
||||||
}}
|
}}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user