import { useQuery } from "@tanstack/react-query"; import { Link } from "expo-router"; import React, { useState } from "react"; import { ScrollView, Text, View } from "react-native"; import { useApp } from "../src/app-context"; import { profileApi } from "../src/services"; import { Button, ErrorNotice, Header, Loading, styles } from "../src/ui"; export default function ProfileScreen() { const app = useApp(); const enabled = app.authStatus === "authenticated"; const profile = useQuery({ queryKey: ["profile"], queryFn: profileApi.me, enabled }); const documents = useQuery({ queryKey: ["documents"], queryFn: profileApi.documents, enabled }); const [downloadError, setDownloadError] = useState(); const download = async (id: string) => { try { const result = await profileApi.documentUrl(id); if (typeof window !== "undefined") window.location.assign(result.download_url); } catch (error) { setDownloadError(error); } }; if (!enabled) return
Профиль Профиль доступен после авторизации. Перейти в чат для входа ; const personal = profile.data?.profile.personal_data; return
void app.signOut()} /> Профиль {(profile.isLoading || documents.isLoading) && } {(profile.error || documents.error) && { void profile.refetch(); void documents.refetch(); }} />} Личные данные Редактирование профиля недоступно. Для изменения данных напишите оператору. Написать оператору Документы {!documents.data?.items.length && Документов пока нет.} {documents.data?.items.map((document) => {document.name} {new Date(document.sent_at).toLocaleDateString("ru-RU")}