chore: workspace name

This commit is contained in:
DarkSky
2022-08-12 19:29:33 +08:00
parent 8358c66702
commit 8b239cd292
4 changed files with 7 additions and 22 deletions
@@ -92,18 +92,16 @@ export const WorkspaceName = () => {
const { fixedDisplay, toggleSpaceSidebar } = useShowSpaceSidebar();
const [inRename, setInRename] = useState(false);
const [workspaceName, setWorkspaceName] = useState('');
const [workspaceId, setWorkspaceId] = useState('');
const fetchWorkspaceName = useCallback(async () => {
if (!currentSpaceId) {
return;
}
const [name, workspaceId] = await Promise.all([
services.api.userConfig.getWorkspaceName(currentSpaceId),
services.api.userConfig.getWorkspaceId(currentSpaceId),
]);
const name = await services.api.userConfig.getWorkspaceName(
currentSpaceId
);
setWorkspaceName(name);
setWorkspaceId(workspaceId);
}, [currentSpaceId]);
useEffect(() => {
@@ -180,7 +178,7 @@ export const WorkspaceName = () => {
) : (
<WorkspaceNameContainer>
<span onClick={() => setInRename(true)}>
{workspaceName || workspaceId}
{workspaceName || currentSpaceId}
</span>
</WorkspaceNameContainer>
)}