replace eslint/prettier with rome

This commit is contained in:
Ren Amamiya
2023-05-14 17:05:53 +07:00
parent 48d690d33a
commit 409a625dcc
154 changed files with 7639 additions and 8525 deletions

View File

@@ -1,34 +1,34 @@
import { METADATA_SERVICE } from '@stores/constants';
import { METADATA_SERVICE } from "@stores/constants";
import { createPleb, getPleb } from '@utils/storage';
import { createPleb, getPleb } from "@utils/storage";
import useSWR from 'swr';
import useSWR from "swr";
const fetcher = async (pubkey: string) => {
const result = await getPleb(pubkey);
if (result) {
const metadata = JSON.parse(result['metadata']);
result['content'] = metadata.content;
delete result['metadata'];
const result = await getPleb(pubkey);
if (result) {
const metadata = JSON.parse(result["metadata"]);
result["content"] = metadata.content;
result["metadata"] = undefined;
return result;
} else {
const result = await fetch(`${METADATA_SERVICE}/${pubkey}/metadata.json`);
const resultJSON = await result.json();
const cache = await createPleb(pubkey, resultJSON);
return result;
} else {
const result = await fetch(`${METADATA_SERVICE}/${pubkey}/metadata.json`);
const resultJSON = await result.json();
const cache = await createPleb(pubkey, resultJSON);
if (cache) {
return resultJSON;
}
}
if (cache) {
return resultJSON;
}
}
};
export function useProfile(pubkey: string) {
const { data, error, isLoading } = useSWR(pubkey, fetcher);
const { data, error, isLoading } = useSWR(pubkey, fetcher);
return {
user: data ? JSON.parse(data.content ? data.content : null) : null,
isLoading,
isError: error,
};
return {
user: data ? JSON.parse(data.content ? data.content : null) : null,
isLoading,
isError: error,
};
}