fix: publish workspace status will hide workspace setting model

This commit is contained in:
DiamondThree
2022-12-23 10:56:02 +08:00
parent 5d360cfbf7
commit 4da20a6ee0
@@ -292,14 +292,14 @@ const MembersPage = ({ workspace }: { workspace: Workspace }) => {
}; };
const PublishPage = ({ workspace }: { workspace: Workspace }) => { const PublishPage = ({ workspace }: { workspace: Workspace }) => {
const { refreshWorkspacesMeta } = useAppState();
const shareUrl = window.location.host + '/workspace/' + workspace.id; const shareUrl = window.location.host + '/workspace/' + workspace.id;
const [publicStatus, setPublicStatus] = useState<boolean>(workspace.public);
const togglePublic = (flag: boolean) => { const togglePublic = (flag: boolean) => {
updateWorkspace({ updateWorkspace({
id: workspace.id, id: workspace.id,
public: flag, public: flag,
}).then(data => { }).then(data => {
refreshWorkspacesMeta(); setPublicStatus(!publicStatus);
toast('Updated'); toast('Updated');
}); });
}; };
@@ -310,7 +310,7 @@ const PublishPage = ({ workspace }: { workspace: Workspace }) => {
return ( return (
<div> <div>
<StyledPublishContent> <StyledPublishContent>
{workspace.public ? ( {publicStatus ? (
<> <>
<StyledPublishExplanation> <StyledPublishExplanation>
The current workspace has been published to the web, everyone can The current workspace has been published to the web, everyone can
@@ -333,7 +333,7 @@ const PublishPage = ({ workspace }: { workspace: Workspace }) => {
</StyledPublishExplanation> </StyledPublishExplanation>
)} )}
</StyledPublishContent> </StyledPublishContent>
{!workspace.public ? ( {!publicStatus ? (
<Button <Button
onClick={() => { onClick={() => {
togglePublic(true); togglePublic(true);