diff options
-rw-r--r-- | .eslintrc.json | 1 | ||||
-rw-r--r-- | src/ProfileInfo/ProfileInfo.tsx | 2 | ||||
-rw-r--r-- | src/index.tsx | 9 |
3 files changed, 10 insertions, 2 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index ac3fbd3..7b16771 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,6 +17,7 @@ "comma-dangle": ["error", "never"], "import/extensions": ["error", { "ts": "never", "tsx": "never" }], "arrow-body-style": 0, + "no-underscore-dangle": 0, "no-cond-assign": 0, "linebreak-style": 0, "react/prop-types": 0, diff --git a/src/ProfileInfo/ProfileInfo.tsx b/src/ProfileInfo/ProfileInfo.tsx index 2bba586..a7289df 100644 --- a/src/ProfileInfo/ProfileInfo.tsx +++ b/src/ProfileInfo/ProfileInfo.tsx @@ -37,7 +37,7 @@ const useStyles = makeStyles({ const ProfileInfo: React.FC<PropTypes> = ({ id }) => { const [userInfo, setUserInfo] = useState<User>(); - get(`/users/ + ${id}`).then(response => { + get(`/users/${id}`).then(response => { setUserInfo(response.data); }); diff --git a/src/index.tsx b/src/index.tsx index 9fb34cb..adf44a5 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -13,6 +13,8 @@ import Header from './Header/Header'; import Feed from './Feed/Feed'; import ProfileInfo from './ProfileInfo/ProfileInfo'; +import { get } from './requests'; + const theme = createMuiTheme({ palette: { primary: { @@ -31,15 +33,20 @@ const useStyles = makeStyles({ const App: React.FC = () => { const [page, setPage] = useState('feed'); + const [id, setId] = useState<string>(''); const classes = useStyles(); + get('/users').then(response => { + setId(response.data[0]._id); + }); + return ( <ThemeProvider theme={theme}> <CssBaseline /> <Header setPage={setPage} /> <div className={classes.root}> { - page === 'profile' && <ProfileInfo id="5ee39a3b29600306e4e2b0b7" /> + page === 'profile' && <ProfileInfo id={id} /> } <Feed page={page} /> </div> |