mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(plebbit options): schema error prevented to save
This commit is contained in:
@@ -148,19 +148,50 @@ const PlebbitOptions = () => {
|
|||||||
const solRpcRef = useRef<HTMLTextAreaElement>(null);
|
const solRpcRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const maticRpcRef = useRef<HTMLTextAreaElement>(null);
|
const maticRpcRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const avaxRpcRef = useRef<HTMLTextAreaElement>(null);
|
const avaxRpcRef = useRef<HTMLTextAreaElement>(null);
|
||||||
|
const httpRoutersRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const plebbitRpcRef = useRef<HTMLInputElement>(null);
|
const plebbitRpcRef = useRef<HTMLInputElement>(null);
|
||||||
const plebbitDataPathRef = useRef<HTMLInputElement>(null);
|
const plebbitDataPathRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
const ipfsGatewayUrls = ipfsGatewayUrlsRef.current?.value.split('\n').map((url) => url.trim());
|
const ipfsGatewayUrls = ipfsGatewayUrlsRef.current?.value
|
||||||
|
.split('\n')
|
||||||
|
.map((url) => url.trim())
|
||||||
|
.filter((url) => url !== '');
|
||||||
|
|
||||||
const mediaIpfsGatewayUrl = mediaIpfsGatewayUrlRef.current?.value.trim();
|
const mediaIpfsGatewayUrl = mediaIpfsGatewayUrlRef.current?.value.trim();
|
||||||
const pubsubHttpClientsOptions = pubsubProvidersRef.current?.value.split('\n').map((url) => url.trim());
|
|
||||||
const ethRpcUrls = ethRpcRef.current?.value.split('\n').map((url) => url.trim());
|
const pubsubHttpClientsOptions = pubsubProvidersRef.current?.value
|
||||||
const solRpcUrls = solRpcRef.current?.value.split('\n').map((url) => url.trim());
|
.split('\n')
|
||||||
const maticRpcUrls = maticRpcRef.current?.value.split('\n').map((url) => url.trim());
|
.map((url) => url.trim())
|
||||||
const avaxRpcUrls = avaxRpcRef.current?.value.split('\n').map((url) => url.trim());
|
.filter((url) => url !== '');
|
||||||
const plebbitRpcClientsOptions = plebbitRpcRef.current?.value.trim();
|
|
||||||
const plebbitDataPath = plebbitDataPathRef.current?.value.trim();
|
const ethRpcUrls = ethRpcRef.current?.value
|
||||||
|
.split('\n')
|
||||||
|
.map((url) => url.trim())
|
||||||
|
.filter((url) => url !== '');
|
||||||
|
|
||||||
|
const solRpcUrls = solRpcRef.current?.value
|
||||||
|
.split('\n')
|
||||||
|
.map((url) => url.trim())
|
||||||
|
.filter((url) => url !== '');
|
||||||
|
|
||||||
|
const maticRpcUrls = maticRpcRef.current?.value
|
||||||
|
.split('\n')
|
||||||
|
.map((url) => url.trim())
|
||||||
|
.filter((url) => url !== '');
|
||||||
|
|
||||||
|
const avaxRpcUrls = avaxRpcRef.current?.value
|
||||||
|
.split('\n')
|
||||||
|
.map((url) => url.trim())
|
||||||
|
.filter((url) => url !== '');
|
||||||
|
|
||||||
|
const httpRoutersOptions = httpRoutersRef.current?.value
|
||||||
|
.split('\n')
|
||||||
|
.map((url) => url.trim())
|
||||||
|
.filter((url) => url !== '');
|
||||||
|
|
||||||
|
const plebbitRpcClientsOptions = plebbitRpcRef.current?.value.trim() ? [plebbitRpcRef.current.value.trim()] : undefined;
|
||||||
|
const dataPath = plebbitDataPathRef.current?.value.trim() || undefined;
|
||||||
|
|
||||||
const chainProviders = {
|
const chainProviders = {
|
||||||
eth: {
|
eth: {
|
||||||
@@ -190,11 +221,12 @@ const PlebbitOptions = () => {
|
|||||||
ipfsGatewayUrls,
|
ipfsGatewayUrls,
|
||||||
pubsubHttpClientsOptions,
|
pubsubHttpClientsOptions,
|
||||||
chainProviders,
|
chainProviders,
|
||||||
|
httpRoutersOptions,
|
||||||
plebbitRpcClientsOptions,
|
plebbitRpcClientsOptions,
|
||||||
plebbitDataPath,
|
dataPath,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
alert('Options saved.');
|
alert('Options saved, reloading...');
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof Error) {
|
if (e instanceof Error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user