X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fperson%2Fsettings.tsx;h=a29f61b008102ba4d60e3ab0d4988bd13e8f34d4;hb=2b1af707c3df6126b3e6890106c03c60ad49b1be;hp=40878f37fddc4fa93b3d751bc57e5458306247a9;hpb=f61037f5d89f12818c8100f907a98b74e980112a;p=lemmy-ui.git diff --git a/src/shared/components/person/settings.tsx b/src/shared/components/person/settings.tsx index 40878f3..a29f61b 100644 --- a/src/shared/components/person/settings.tsx +++ b/src/shared/components/person/settings.tsx @@ -1,26 +1,19 @@ import { NoOptionI18nKeys } from "i18next"; import { Component, linkEvent } from "inferno"; import { - BlockCommunity, BlockCommunityResponse, - BlockPerson, BlockPersonResponse, - ChangePassword, CommunityBlockView, - DeleteAccount, + DeleteAccountResponse, GetSiteResponse, ListingType, LoginResponse, PersonBlockView, - SaveUserSettings, SortType, - UserOperation, - wsJsonToRes, - wsUserOp, } from "lemmy-js-client"; -import { Subscription } from "rxjs"; import { i18n, languages } from "../../i18next"; -import { UserService, WebSocketService } from "../../services"; +import { UserService } from "../../services"; +import { HttpService, RequestState } from "../../services/HttpService"; import { Choice, capitalizeFirstLetter, @@ -34,6 +27,7 @@ import { fetchUsers, getLanguages, myAuth, + myAuthRequired, personToChoice, relTags, setIsoData, @@ -43,8 +37,6 @@ import { toast, updateCommunityBlock, updatePersonBlock, - wsClient, - wsSubscribe, } from "../../utils"; import { HtmlTags } from "../common/html-tags"; import { Icon, Spinner } from "../common/icon"; @@ -59,6 +51,9 @@ import { CommunityLink } from "../community/community-link"; import { PersonListing } from "./person-listing"; interface SettingsState { + saveRes: RequestState; + changePasswordRes: RequestState; + deleteAccountRes: RequestState; // TODO redo these forms saveUserSettingsForm: { show_nsfw?: boolean; @@ -94,9 +89,6 @@ interface SettingsState { communityBlocks: CommunityBlockView[]; currentTab: string; themeList: string[]; - saveUserSettingsLoading: boolean; - changePasswordLoading: boolean; - deleteAccountLoading: boolean; deleteAccountShowConfirm: boolean; siteRes: GetSiteResponse; searchCommunityLoading: boolean; @@ -143,13 +135,12 @@ const Filter = ({ export class Settings extends Component { private isoData = setIsoData(this.context); - private subscription?: Subscription; state: SettingsState = { + saveRes: { state: "empty" }, + deleteAccountRes: { state: "empty" }, + changePasswordRes: { state: "empty" }, saveUserSettingsForm: {}, changePasswordForm: {}, - saveUserSettingsLoading: false, - changePasswordLoading: false, - deleteAccountLoading: false, deleteAccountShowConfirm: false, deleteAccountForm: {}, personBlocks: [], @@ -180,8 +171,8 @@ export class Settings extends Component { this.userSettings = this.userSettings.bind(this); this.blockCards = this.blockCards.bind(this); - this.parseMessage = this.parseMessage.bind(this); - this.subscription = wsSubscribe(this.parseMessage); + this.handleBlockPerson = this.handleBlockPerson.bind(this); + this.handleBlockCommunity = this.handleBlockCommunity.bind(this); const mui = UserService.Instance.myUserInfo; if (mui) { @@ -245,10 +236,6 @@ export class Settings extends Component { this.setState({ themeList: await fetchThemeList() }); } - componentWillUnmount() { - this.subscription?.unsubscribe(); - } - get documentTitle(): string { return i18n.t("settings"); } @@ -375,7 +362,7 @@ export class Settings extends Component {