update
This commit is contained in:
@@ -128,9 +128,9 @@ async setSigner(id: string) : Promise<Result<null, string>> {
|
||||
else return { status: "error", error: e as any };
|
||||
}
|
||||
},
|
||||
async getProfile(id: string) : Promise<Result<string, string>> {
|
||||
async getProfile(id: string, cacheOnly: boolean) : Promise<Result<string, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_profile", { id }) };
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_profile", { id, cacheOnly }) };
|
||||
} catch (e) {
|
||||
if(e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
|
||||
@@ -45,12 +45,12 @@ export function NoteRepost({
|
||||
const list: Promise<MenuItem>[] = [];
|
||||
|
||||
for (const account of accounts) {
|
||||
const res = await commands.getProfile(account);
|
||||
const res = await commands.getProfile(account, true);
|
||||
let name = "unknown";
|
||||
|
||||
if (res.status === "ok") {
|
||||
const profile: Metadata = JSON.parse(res.data);
|
||||
name = profile.display_name ?? profile.name ?? "unknown";
|
||||
name = profile.display_name ?? profile.name ?? "anon";
|
||||
}
|
||||
|
||||
list.push(
|
||||
|
||||
@@ -199,12 +199,12 @@ function OpenLaunchpad() {
|
||||
const list: Promise<MenuItem>[] = [];
|
||||
|
||||
for (const account of accounts) {
|
||||
const res = await commands.getProfile(account);
|
||||
const res = await commands.getProfile(account, true);
|
||||
let name = "unknown";
|
||||
|
||||
if (res.status === "ok") {
|
||||
const profile: Metadata = JSON.parse(res.data);
|
||||
name = profile.display_name ?? profile.name ?? "unknown";
|
||||
name = profile.display_name ?? profile.name ?? "anon";
|
||||
}
|
||||
|
||||
list.push(
|
||||
|
||||
@@ -104,12 +104,12 @@ function Screen() {
|
||||
const list: Promise<MenuItem>[] = [];
|
||||
|
||||
for (const account of accounts) {
|
||||
const res = await commands.getProfile(account);
|
||||
const res = await commands.getProfile(account, true);
|
||||
let name = "unknown";
|
||||
|
||||
if (res.status === "ok") {
|
||||
const profile: Metadata = JSON.parse(res.data);
|
||||
name = profile.display_name ?? profile.name ?? "unknown";
|
||||
name = profile.display_name ?? profile.name ?? "anon";
|
||||
}
|
||||
|
||||
list.push(
|
||||
|
||||
@@ -3,7 +3,7 @@ import { createFileRoute } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/settings/$id/profile")({
|
||||
beforeLoad: async ({ params }) => {
|
||||
const res = await commands.getProfile(params.id);
|
||||
const res = await commands.getProfile(params.id, true);
|
||||
|
||||
if (res.status === "ok") {
|
||||
const profile: Profile = JSON.parse(res.data);
|
||||
|
||||
@@ -31,12 +31,12 @@ function Screen() {
|
||||
const list: Promise<MenuItem>[] = [];
|
||||
|
||||
for (const account of accounts) {
|
||||
const res = await commands.getProfile(account);
|
||||
const res = await commands.getProfile(account, true);
|
||||
let name = "unknown";
|
||||
|
||||
if (res.status === "ok") {
|
||||
const profile: Metadata = JSON.parse(res.data);
|
||||
name = profile.display_name ?? profile.name ?? "unknown";
|
||||
name = profile.display_name ?? profile.name ?? "anon";
|
||||
}
|
||||
|
||||
list.push(
|
||||
|
||||
@@ -26,7 +26,7 @@ export function useProfile(pubkey: string, embed?: string) {
|
||||
}
|
||||
}
|
||||
|
||||
const query = await commands.getProfile(normalizedId);
|
||||
const query = await commands.getProfile(normalizedId, false);
|
||||
|
||||
if (query.status === "ok") {
|
||||
return JSON.parse(query.data) as Metadata;
|
||||
|
||||
Reference in New Issue
Block a user