mirror of
https://github.com/lumehq/lume.git
synced 2025-09-27 08:07:12 +02:00
fixed onboarding
This commit is contained in:
@@ -54,11 +54,13 @@ export default function Page() {
|
|||||||
);
|
);
|
||||||
// insert to database
|
// insert to database
|
||||||
const insertDB = async () => {
|
const insertDB = async () => {
|
||||||
await db.execute(
|
await db.execute('INSERT OR IGNORE INTO accounts (id, privkey, npub, nsec, metadata) VALUES (?, ?, ?, ?, ?)', [
|
||||||
`INSERT INTO accounts (id, privkey, npub, nsec, metadata) VALUES ("${pubKey}", "${privKey}", "${npub}", "${nsec}", '${JSON.stringify(
|
pubKey,
|
||||||
data
|
privKey,
|
||||||
)}')`
|
npub,
|
||||||
);
|
nsec,
|
||||||
|
data,
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
// build event and broadcast to all relays
|
// build event and broadcast to all relays
|
||||||
const createAccount = () => {
|
const createAccount = () => {
|
||||||
|
@@ -3,7 +3,7 @@ import BaseLayout from '@layouts/base';
|
|||||||
import { DatabaseContext } from '@components/contexts/database';
|
import { DatabaseContext } from '@components/contexts/database';
|
||||||
import { RelayContext } from '@components/contexts/relay';
|
import { RelayContext } from '@components/contexts/relay';
|
||||||
|
|
||||||
import { useLocalStorage } from '@rehooks/local-storage';
|
import { useLocalStorage, writeStorage } from '@rehooks/local-storage';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { getPublicKey, nip19 } from 'nostr-tools';
|
import { getPublicKey, nip19 } from 'nostr-tools';
|
||||||
@@ -37,9 +37,15 @@ export default function Page() {
|
|||||||
const npub = privkey ? nip19.npubEncode(pubkey) : null;
|
const npub = privkey ? nip19.npubEncode(pubkey) : null;
|
||||||
const nsec = privkey ? nip19.nsecEncode(privkey) : null;
|
const nsec = privkey ? nip19.nsecEncode(privkey) : null;
|
||||||
// insert to database
|
// insert to database
|
||||||
await db.execute(
|
await db.execute('INSERT OR IGNORE INTO accounts (id, privkey, npub, nsec, metadata) VALUES (?, ?, ?, ?, ?)', [
|
||||||
`INSERT OR IGNORE INTO accounts (id, privkey, npub, nsec, metadata) VALUES ("${pubkey}", "${privkey}", "${npub}", "${nsec}", '${metadata}')`
|
pubkey,
|
||||||
);
|
privkey,
|
||||||
|
npub,
|
||||||
|
nsec,
|
||||||
|
metadata,
|
||||||
|
]);
|
||||||
|
// write to localstorage
|
||||||
|
writeStorage('current-user', { id: pubkey, privkey: privkey, npub: npub, nsec: nsec, metadata: metadata });
|
||||||
// update state
|
// update state
|
||||||
setProfile(JSON.parse(metadata));
|
setProfile(JSON.parse(metadata));
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user