Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Team-Lecue/Lecue-Client
Browse files Browse the repository at this point in the history
…into Hotfix-Dori
  • Loading branch information
doyn511 committed Jan 19, 2024
2 parents 206b34f + 761c40e commit 4bf0c53
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/CreateBook/components/BookInfoTextarea/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function BookInfoTextarea({
changeDescription,
}: BookInfoTextareaProps) {
const handleChangeInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
if (e.target.value.length <= 85) {
if (e.target.value.length <= 65) {
changeDescription(e.target.value);
}
};
Expand All @@ -22,7 +22,7 @@ function BookInfoTextarea({
value={description}
onChange={handleChangeInput}
/>
<S.WordCount>({description.length}/85)</S.WordCount>
<S.WordCount>({description.length}/65)</S.WordCount>
</S.TextareaContainer>
</S.BookInfoWrapper>
);
Expand Down
16 changes: 10 additions & 6 deletions src/Detail/components/LecueNoteListContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function LecueNoteListContainer(props: LecueNoteListContainerProps) {
localStorage.getItem('token') &&
localStorage.getItem('token') !== null
) {
navigate(`/create-note/${bookUuid}`, {
navigate(`/create-note`, {
state: { bookId: bookId },
});
} else {
Expand Down Expand Up @@ -181,11 +181,15 @@ function LecueNoteListContainer(props: LecueNoteListContainerProps) {

{!isEditable && (
<>
<S.StickerButton type="button" onClick={handleClickStickerButton}>
{backgroundColor === '#F5F5F5'
? noteList.length !== 0 && <BtnFloatingSticker />
: noteList.length !== 0 && <BtnFloatingStickerOrange />}
</S.StickerButton>
{noteList.length !== 0 && (
<S.StickerButton type="button" onClick={handleClickStickerButton}>
{backgroundColor === '#F5F5F5' ? (
<BtnFloatingSticker />
) : (
<BtnFloatingStickerOrange />
)}
</S.StickerButton>
)}
<S.WriteButton type="button" onClick={handleClickWriteButton}>
{backgroundColor === '#F5F5F5' ? (
<BtnFloatingWrite />
Expand Down
6 changes: 5 additions & 1 deletion src/LecueNote/hooks/usePostLecueNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const usePostLecueNote = () => {
bookId,
});
},
onError:() => navigate('/error'),
onError: () => navigate('/error'),
onSuccess: (data) => {
const bookUuid = data.data.data.bookUuid;
navigate(`/lecue-book/${bookUuid}`);
},
});
return mutation;
};
Expand Down
4 changes: 1 addition & 3 deletions src/LecueNote/page/LeceuNotePage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react';
import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router-dom';

import Header from '../../../components/common/Header';
import LoadingPage from '../../../components/common/LoadingPage';
Expand Down Expand Up @@ -37,7 +37,6 @@ function LecueNotePage() {
const location = useLocation();

const { bookId } = location.state;
const { bookUuid } = useParams() as { bookUuid: string };

const handleClickCategory = (
e: React.MouseEvent<HTMLButtonElement, MouseEvent>,
Expand Down Expand Up @@ -86,7 +85,6 @@ function LecueNotePage() {
isIconClicked: isIconClicked,
bookId: bookId,
});
navigate(`/lecue-book/${bookUuid}`);
};

return putMutation.isLoading || postMutation.isLoading ? (
Expand Down
15 changes: 11 additions & 4 deletions src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Router() {
<Route path="/" element={<SelectView />} />
<Route path="/register" element={<Register />} />
<Route path="/login" element={<Login />} />
<Route path="/create-note/:bookUuid" element={<LecueNotePage />} />
<Route path="/create-note" element={<LecueNotePage />} />
<Route path="/sticker-pack" element={<StickerPack />} />
<Route path="/detail" element={<DetailPage />} />
<Route path="/mypage" element={<Mypage />} />
Expand All @@ -55,15 +55,22 @@ function Router() {
export default Router;

function fallbackRender({ error, resetErrorBoundary }: any) {
if (error.response.status === 404) {
if (error.response.status === 404 || error.error.response.status === 404) {
resetErrorBoundary();
return <Login />;
} else if (error.response.status === 401) {
} else if (
error.response.status === 401 ||
error.error.response.status === 401
) {
resetErrorBoundary();
localStorage.removeItem('token');
localStorage.removeItem('nickname');
return <Login />;
} else {
location.reload();
alert(
` ${error.response.status},
${error.error.response.status},
에러 발생 : 콘솔창 캡쳐해서 개발자 보내주삼`,
);
}
}
2 changes: 1 addition & 1 deletion src/Target/page/TargetPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function TargetPage() {
<LoadingPage />
) : (
<S.TargetPageWrapper>
<Header headerTitle={'레큐북 만들기'} />
<Header headerTitle={'레큐북 제작'} />
<S.TargetPageBodyWrapper>
<S.InputSectionWrapper>
<S.NameInputWrapper>
Expand Down

0 comments on commit 4bf0c53

Please sign in to comment.