Skip to content

Commit

Permalink
Fix user nickname display in shared document (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
choidabom authored Sep 5, 2024
1 parent 3682417 commit 0485293
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions frontend/src/pages/workspace/document/share/Index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import { Box } from "@mui/material";
import { useEffect, useMemo } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Navigate, useLocation, useSearchParams } from "react-router-dom";
import DocumentView from "../../../../components/editor/DocumentView";
import { useGetDocumentBySharingTokenQuery } from "../../../../hooks/api/document";
import { Navigate, useLocation, useSearchParams } from "react-router-dom";
import { useEffect, useMemo } from "react";
import { useYorkieDocument } from "../../../../hooks/useYorkieDocument";
import { useDispatch } from "react-redux";
import { setClient, setDoc, setMode, setShareRole } from "../../../../store/editorSlice";
import { selectUser } from "../../../../store/userSlice";

function DocumentShareIndex() {
const dispatch = useDispatch();
const location = useLocation();
const [searchParams] = useSearchParams();
const userStore = useSelector(selectUser);
const shareToken = useMemo(() => searchParams.get("token"), [searchParams]);
const { data: sharedDocument } = useGetDocumentBySharingTokenQuery(shareToken);
const { doc, client } = useYorkieDocument(sharedDocument?.yorkieDocumentId, "Anonymous");
const { doc, client } = useYorkieDocument(
sharedDocument?.yorkieDocumentId,
userStore.data?.nickname ?? "Anonymous"
);

useEffect(() => {
if (!sharedDocument?.role) return;
Expand Down

0 comments on commit 0485293

Please sign in to comment.