fixed built errors in ssg mode
This commit is contained in:
@@ -3,6 +3,7 @@ import BaseLayout from '@layouts/baseLayout';
|
||||
import OnboardingLayout from '@layouts/onboardingLayout';
|
||||
|
||||
import { motion } from 'framer-motion';
|
||||
import { GetStaticPaths } from 'next';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useNostrEvents } from 'nostr-react';
|
||||
import {
|
||||
@@ -15,12 +16,11 @@ import {
|
||||
} from 'react';
|
||||
import Database from 'tauri-plugin-sql-api';
|
||||
|
||||
export default function Page() {
|
||||
export default function Page({ pubkey }: { pubkey: string }) {
|
||||
const [follows, setFollows] = useState([null]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const router = useRouter();
|
||||
const { pubkey }: any = router.query;
|
||||
|
||||
const { onEvent } = useNostrEvents({
|
||||
filter: {
|
||||
@@ -108,6 +108,20 @@ export default function Page() {
|
||||
);
|
||||
}
|
||||
|
||||
export const getStaticPaths: GetStaticPaths = async () => {
|
||||
return {
|
||||
paths: [],
|
||||
fallback: 'blocking',
|
||||
};
|
||||
};
|
||||
|
||||
export async function getStaticProps(context) {
|
||||
const pubkey = context.params.pubkey;
|
||||
return {
|
||||
props: { pubkey },
|
||||
};
|
||||
}
|
||||
|
||||
Page.getLayout = function getLayout(
|
||||
page:
|
||||
| string
|
||||
@@ -46,10 +46,7 @@ export default function Page() {
|
||||
const pubKey = getPublicKey(privKey);
|
||||
|
||||
if (pubKey) {
|
||||
router.push({
|
||||
pathname: '/onboarding/fetch-profile',
|
||||
query: { privkey: privKey },
|
||||
});
|
||||
router.push(`/onboarding/profile/${privKey}`);
|
||||
}
|
||||
} catch (error) {
|
||||
setError('key', {
|
||||
|
||||
@@ -3,6 +3,7 @@ import BaseLayout from '@layouts/baseLayout';
|
||||
import OnboardingLayout from '@layouts/onboardingLayout';
|
||||
|
||||
import { motion } from 'framer-motion';
|
||||
import { GetStaticPaths } from 'next';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useNostrEvents } from 'nostr-react';
|
||||
import { getPublicKey, nip19 } from 'nostr-tools';
|
||||
@@ -16,12 +17,11 @@ import {
|
||||
} from 'react';
|
||||
import Database from 'tauri-plugin-sql-api';
|
||||
|
||||
export default function Page() {
|
||||
export default function Page({ privkey }: { privkey: string }) {
|
||||
const [account, setAccount] = useState(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const router = useRouter();
|
||||
const { privkey }: any = router.query;
|
||||
|
||||
const pubkey = getPublicKey(privkey);
|
||||
const npub = nip19.npubEncode(pubkey);
|
||||
@@ -61,10 +61,7 @@ export default function Page() {
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
setLoading(false);
|
||||
router.push({
|
||||
pathname: '/onboarding/fetch-follows',
|
||||
query: { pubkey: pubkey },
|
||||
});
|
||||
router.push(`/onboarding/follows/${pubkey}`);
|
||||
}, 1500);
|
||||
})
|
||||
.catch(console.error);
|
||||
@@ -116,6 +113,20 @@ export default function Page() {
|
||||
);
|
||||
}
|
||||
|
||||
export const getStaticPaths: GetStaticPaths = async () => {
|
||||
return {
|
||||
paths: [],
|
||||
fallback: 'blocking',
|
||||
};
|
||||
};
|
||||
|
||||
export async function getStaticProps(context) {
|
||||
const privkey = context.params.privkey;
|
||||
return {
|
||||
props: { privkey },
|
||||
};
|
||||
}
|
||||
|
||||
Page.getLayout = function getLayout(
|
||||
page:
|
||||
| string
|
||||
Reference in New Issue
Block a user