feat: redirect to index after add account
This commit is contained in:
@@ -9,7 +9,7 @@ import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export const Route = createFileRoute("/auth/new/$account/backup")({
|
||||
export const Route = createFileRoute("/auth/$account/backup")({
|
||||
component: Screen,
|
||||
});
|
||||
|
||||
@@ -33,8 +33,7 @@ function Screen() {
|
||||
}
|
||||
|
||||
return navigate({
|
||||
to: "/auth/$account/settings",
|
||||
params: { account },
|
||||
to: "/auth/settings",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ function Screen() {
|
||||
|
||||
if (eventId) {
|
||||
navigate({
|
||||
to: "/auth/new/$account/backup",
|
||||
to: "/auth/$account/backup",
|
||||
params: { account: account.npub },
|
||||
replace: true,
|
||||
});
|
||||
|
||||
@@ -28,8 +28,7 @@ function Screen() {
|
||||
|
||||
if (npub) {
|
||||
navigate({
|
||||
to: "/auth/$account/settings",
|
||||
params: { account: npub },
|
||||
to: "/auth/settings",
|
||||
replace: true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,8 +27,7 @@ function Screen() {
|
||||
|
||||
if (npub) {
|
||||
navigate({
|
||||
to: "/auth/$account/settings",
|
||||
params: { account: npub },
|
||||
to: "/auth/settings",
|
||||
replace: true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export const Route = createFileRoute("/auth/$account/settings")({
|
||||
export const Route = createFileRoute("/auth/settings")({
|
||||
beforeLoad: async () => {
|
||||
const settings = await NostrQuery.getSettings();
|
||||
return { settings };
|
||||
@@ -18,14 +18,14 @@ export const Route = createFileRoute("/auth/$account/settings")({
|
||||
});
|
||||
|
||||
function Screen() {
|
||||
const navigate = Route.useNavigate();
|
||||
const { account } = Route.useParams();
|
||||
const { settings } = Route.useRouteContext();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [newSettings, setNewSettings] = useState(settings);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const navigate = Route.useNavigate();
|
||||
|
||||
const toggleNofitication = async () => {
|
||||
await requestPermission();
|
||||
setNewSettings((prev) => ({
|
||||
@@ -72,8 +72,7 @@ function Screen() {
|
||||
|
||||
if (eventId) {
|
||||
return navigate({
|
||||
to: "/$account/home",
|
||||
params: { account },
|
||||
to: "/",
|
||||
replace: true,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user