-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from SayisMe/dev
Feat: 유저용 링크 생성
- Loading branch information
Showing
6 changed files
with
49 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
// in src/App.tsx | ||
import { Admin, Resource } from "react-admin"; | ||
import { Admin, CustomRoutes, Resource } from "react-admin"; | ||
import { dataProvider } from './dataProvider'; | ||
import { PostList, PostEdit, PostCreate } from "./posts"; | ||
import { UserList } from "./users"; | ||
import PostIcon from "@mui/icons-material/Book"; | ||
import UserIcon from "@mui/icons-material/Group"; | ||
import { Dashboard } from "./Dashboard"; | ||
import { authProvider } from "./authProvider"; | ||
import { BrowserRouter, Routes, Route } from "react-router-dom"; | ||
import UserPage from "./UserPage"; | ||
|
||
export const App = () => ( | ||
<Admin authProvider={authProvider} dataProvider={dataProvider} dashboard={Dashboard}> | ||
{/* <Resource name="posts" list={PostList} edit={PostEdit} create={PostCreate} icon={PostIcon}/> */} | ||
<Resource name="users" list={UserList} icon={UserIcon} recordRepresentation="name"/> | ||
{/* <Resource name="home" list={UserList} /> */} | ||
<Resource name="users" list={UserList} icon={UserIcon} recordRepresentation="name"/> | ||
<CustomRoutes noLayout> | ||
<Route path="/dailyReport/:kakaoId" element={<UserPage />} /> | ||
</CustomRoutes> | ||
</Admin> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// UserPage.tsx | ||
|
||
import { useState, useEffect } from "react"; | ||
import { useParams } from "react-router"; | ||
import Diary from "./diary"; | ||
|
||
const UserPage = () => { | ||
const [selectedUser, setSelectedUser] = useState(null); | ||
const kakaoId = useParams().kakaoId; | ||
|
||
console.log(kakaoId); | ||
useEffect(() => { | ||
fetch(`http://3.38.118.228:8080/api/dailyReport/user/${kakaoId}`) | ||
.then((response) => response.json()) | ||
.then((data) => setSelectedUser(data)); | ||
}, []); | ||
|
||
if(!selectedUser) return <></>; | ||
return <div className="diaries"><div className="diary"><Diary selectedUser={selectedUser}/></div></div>; | ||
} | ||
|
||
export default UserPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
// diary.tsx | ||
// selectedUSer 받아와서 return ! | ||
const Diary = ({selectedUser}) => { | ||
return( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters