fixed sql query

This commit is contained in:
Ren Amamiya
2023-02-26 11:19:18 +07:00
parent a2fcb12eef
commit 3fbe6b3986
7 changed files with 60 additions and 220 deletions

View File

@@ -35,14 +35,14 @@ export default function Page() {
}, []);
const getAccount = useCallback(async () => {
const result = await db.select(`SELECT id FROM accounts ASC LIMIT 1`);
const result = await db.select(`SELECT * FROM accounts ASC LIMIT 1`);
return result;
}, []);
const getFollows = useCallback(async (account) => {
const arr = [];
const result: any = await db.select(`SELECT pubkey FROM follows WHERE account = "${account.pubkey}"`);
const result: any = await db.select(`SELECT pubkey FROM follows WHERE account = "${account.id}"`);
result.forEach((item: { pubkey: string }) => {
arr.push(item.pubkey);
@@ -59,7 +59,6 @@ export default function Page() {
requestNotification().then(() => {
getAccount()
.then((res: any) => {
console.log(res);
if (res.length === 0) {
setTimeout(() => {
setLoading(false);