import Alert from "@mui/material/Alert"; import Skeleton from "@mui/material/Skeleton"; import { ApiService } from "services/apiService/core"; import { UserProfile } from "services/apiService/types"; import { InputList } from "components/Inputs/InputList"; import { useLang } from "services/lang"; import { FC, useState } from "react"; import LinearProgress from "@mui/material/LinearProgress"; export type UserProfileProps = { api: ApiService; }; export const UserProfileEditor: FC = ({ api }) => { const [saving, setIsSaving] = useState(false); const profile = api.state.userProfile; const lang = useLang(); if (!profile.ready) { return (
); } if (!profile.ok) { return (
{JSON.stringify(profile.error)}
); } const update = (key: K) => (data: D) => { if (profile.ready) { setIsSaving(true); api .setProfile({ ...profile.data, [key]: data, }) .then(() => { setIsSaving(false); }); } }; return (
{saving && }
); };