mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2026-02-02 04:54:21 +01:00
set lsps settings via url query params
This commit is contained in:
committed by
benthecarman
parent
996656d1cd
commit
4de57712aa
@@ -1,8 +1,16 @@
|
||||
import { useSearchParams } from "@solidjs/router";
|
||||
import { createEffect, createSignal, Show } from "solid-js";
|
||||
import { createEffect, createSignal, onMount, Show } from "solid-js";
|
||||
|
||||
import { Button, InfoBox, NiceP, SimpleDialog, VStack } from "~/components";
|
||||
import {
|
||||
Button,
|
||||
InfoBox,
|
||||
NiceP,
|
||||
showToast,
|
||||
SimpleDialog,
|
||||
VStack
|
||||
} from "~/components";
|
||||
import { useI18n } from "~/i18n/context";
|
||||
import { setSettings } from "~/logic/mutinyWalletSetup";
|
||||
import { useMegaStore } from "~/state/megaStore";
|
||||
import { bech32, bech32WordsToUrl, eify } from "~/utils";
|
||||
|
||||
@@ -51,6 +59,35 @@ export function HomePrompt() {
|
||||
}
|
||||
});
|
||||
|
||||
// LSPS stuff
|
||||
onMount(async () => {
|
||||
if (params.lsps) {
|
||||
const values = {
|
||||
lsp: "",
|
||||
lsps_connection_string: params.lsps,
|
||||
lsps_token: params.token
|
||||
};
|
||||
try {
|
||||
await state.mutiny_wallet?.change_lsp(
|
||||
values.lsp ? values.lsp : undefined,
|
||||
values.lsps_connection_string
|
||||
? values.lsps_connection_string
|
||||
: undefined,
|
||||
values.lsps_token ? values.lsps_token : undefined
|
||||
);
|
||||
await setSettings(values);
|
||||
setParams({ lsps: undefined, token: undefined });
|
||||
showToast({
|
||||
title: "Success",
|
||||
description: "LSPS settings changed"
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("Error changing lsp:", e);
|
||||
showToast(eify(e));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Lnurl Auth stuff
|
||||
const [lnurlauthResult, setLnurlauthResult] = createSignal<string>();
|
||||
const [authLoading, setAuthLoading] = createSignal<boolean>(false);
|
||||
|
||||
Reference in New Issue
Block a user