mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-04-15 05:44:11 +00:00
FormWithData structure for user forms
This commit is contained in:
parent
85e7f2ccb5
commit
5d0aa28633
2 changed files with 16 additions and 24 deletions
|
@ -38,21 +38,20 @@ const {
|
|||
Checkbox
|
||||
} = require("../components/form/inputs");
|
||||
|
||||
const FormWithData = require("../lib/form/form-with-data");
|
||||
const FakeProfile = require("../components/fake-profile");
|
||||
const MutationButton = require("../components/form/mutation-button");
|
||||
const Loading = require("../components/loading");
|
||||
|
||||
module.exports = function UserProfile() {
|
||||
const {data: profile = {}, isLoading} = query.useVerifyCredentialsQuery();
|
||||
|
||||
if (isLoading) {
|
||||
return <Loading/>;
|
||||
} else {
|
||||
return <UserProfileForm profile={profile} />;
|
||||
}
|
||||
return (
|
||||
<FormWithData
|
||||
dataQuery={query.useVerifyCredentialsQuery}
|
||||
DataForm={UserProfileForm}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
function UserProfileForm({profile}) {
|
||||
function UserProfileForm({data: profile}) {
|
||||
/*
|
||||
User profile update form keys
|
||||
- bool bot
|
||||
|
|
|
@ -18,14 +18,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const Promise = require("bluebird");
|
||||
const React = require("react");
|
||||
const Redux = require("react-redux");
|
||||
|
||||
const api = require("../lib/api");
|
||||
|
||||
const Languages = require("../components/languages");
|
||||
const Submit = require("../components/submit");
|
||||
|
||||
const query = require("../lib/query");
|
||||
|
||||
|
@ -42,17 +35,17 @@ const {
|
|||
Checkbox
|
||||
} = require("../components/form/inputs");
|
||||
|
||||
const FormWithData = require("../lib/form/form-with-data");
|
||||
const Languages = require("../components/languages");
|
||||
const MutationButton = require("../components/form/mutation-button");
|
||||
const Loading = require("../components/loading");
|
||||
|
||||
module.exports = function UserSettings() {
|
||||
const {data: profile, isLoading} = query.useVerifyCredentialsQuery();
|
||||
|
||||
if (isLoading) {
|
||||
return <Loading/>;
|
||||
} else {
|
||||
return <UserSettingsForm source={profile.source} />;
|
||||
}
|
||||
return (
|
||||
<FormWithData
|
||||
dataQuery={query.useVerifyCredentialsQuery}
|
||||
DataForm={UserSettingsForm}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
function UserSettingsForm({source}) {
|
||||
|
|
Loading…
Reference in a new issue