Skip to content

Commit

Permalink
Merge pull request #60 from sunnybraille/request
Browse files Browse the repository at this point in the history
fix: login status maintain
  • Loading branch information
jun-brro authored Mar 18, 2024
2 parents 1ba6560 + 67b83b4 commit 4df746a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 9 additions & 2 deletions my-app/src/components/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,16 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
);

useEffect(() => {
const sessionExists = !!cookies["sessionId"];
const sessionExists = !!cookies.sessionId;
setIsLoggedIn(sessionExists);
}, [cookies, setIsLoggedIn]);
}, [cookies.sessionId, setIsLoggedIn]);

useEffect(() => {
const session = localStorage.getItem("isLoggedIn");
if (session === "true") {
setIsLoggedIn(true);
}
});

const login = async (loginId: string, password: string) => {
try {
Expand Down
5 changes: 1 addition & 4 deletions my-app/src/components/FileNameDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ const FileNameDisplay: React.FC<FileNameDisplayProps> = ({ fileId }) => {
const response = await axios.get(`${apiUrl}/transcriptions/${fileId}`);
const originalFileName = response.data.originalFileName;

const fileNameWithoutExtension = originalFileName
.split(".")
.slice(0, -1)
.join(".");
const fileNameWithoutExtension = originalFileName;
setFileName(fileNameWithoutExtension);
} catch (error) {
console.error("파일 정보를 불러오는데 실패했습니다.", error);
Expand Down

0 comments on commit 4df746a

Please sign in to comment.