{props.message}
diff --git a/my-app/src/components/Profile/Profile.tsx b/my-app/src/components/Profile/Profile.tsx
index b181c82..1fccf00 100644
--- a/my-app/src/components/Profile/Profile.tsx
+++ b/my-app/src/components/Profile/Profile.tsx
@@ -2,8 +2,18 @@ import React from 'react';
import styles from './Profile.module.css';
import MyPostsContainer from './MyPosts/MyPostsContainer';
import ProfileInfo from './ProfileInfo/ProfileInfo'
+import {ProfileType} from "../../redux/types/types";
-const Profile = (props) => {
+type PropsType={
+ profile: ProfileType | null
+ savePhoto: (file: File)=>void,
+ saveProfile: (profile: ProfileType)=>void
+ isOwner: boolean
+ status: string,
+ updateStatus: (status: string)=>void
+}
+
+const Profile: React.FC
= (props) => {
return (
diff --git a/my-app/src/components/Profile/ProfileContainer.tsx b/my-app/src/components/Profile/ProfileContainer.tsx
index 8e8cb78..9d7feea 100644
--- a/my-app/src/components/Profile/ProfileContainer.tsx
+++ b/my-app/src/components/Profile/ProfileContainer.tsx
@@ -9,27 +9,53 @@ import {
import { connect } from "react-redux";
import { withRouter } from 'react-router-dom';
import { compose } from 'redux';
+import {AppStateType} from "../../redux/redux-store";
+import {ProfileType} from "../../redux/types/types";
+import {RouteComponentProps} from "react-router-dom"
-class ProfileContainer extends React.Component {
+type MapStatePropsType= ReturnType
+type DispatchProps={
+ getProfileThunkCreator:(userId: number)=>void
+ getProfileStatusThunkCreator:(userId: number)=>void
+ updateProfileStatusThunkCreator:(status: string)=>void
+ savePhoto:(file: File)=>void
+ saveProfile:(profile: ProfileType)=>void
+}
+type PropsType= MapStatePropsType & DispatchProps & RouteComponentProps
+
+type PathParamsType = {
+ userId: string
+}
+
+
+class ProfileContainer extends React.Component {
refreshProfile() {
- let userId = this.props.match.params.userId
+ debugger
+
+ let userId: number | null= +this.props.match.params.userId
if (!userId) {
- userId = this.props.autorizedUserId;
+ userId = this.props.autorizedUserId;
if (!userId) {
this.props.history.push("/login")
}
}
- this.props.getProfileThunkCreator(userId);
- this.props.getProfileStatusThunkCreator(userId);
+ if(!userId){
+ console.log('ID should exist in URL')
+ }else{
+ debugger
+ this.props.getProfileThunkCreator(userId);
+ this.props.getProfileStatusThunkCreator(userId);
+ }
+
}
componentDidMount() {
this.refreshProfile()
}
- componentDidUpdate(prevProps) {
+ componentDidUpdate(prevProps:PropsType) {
if(this.props.match.params.userId!==prevProps.match.params.userId)
this.refreshProfile()
@@ -38,7 +64,7 @@ class ProfileContainer extends React.Component {
render() {
return (
- < div >
+
({
+let mapStateToProps = (state: AppStateType) => ({
profile: state.profilePage.profile,
status: state.profilePage.status,
isAuth: state.auth.isAuth,
@@ -59,7 +85,7 @@ let mapStateToProps = (state) => ({
});
-export default compose(
+export default compose(
connect(mapStateToProps,
{ getProfileThunkCreator, getProfileStatusThunkCreator, updateProfileStatusThunkCreator,
savePhoto, saveProfile}),
diff --git a/my-app/src/components/Profile/ProfileInfo/ProfileDataForm.tsx b/my-app/src/components/Profile/ProfileInfo/ProfileDataForm.tsx
index df2c75b..3c0994f 100644
--- a/my-app/src/components/Profile/ProfileInfo/ProfileDataForm.tsx
+++ b/my-app/src/components/Profile/ProfileInfo/ProfileDataForm.tsx
@@ -1,8 +1,12 @@
import React from "react"
-import { Field, reduxForm } from 'redux-form';
+import {Field, InjectedFormProps, reduxForm} from 'redux-form';
import styles from './ProfileInfo.module.css';
+import {ProfileType} from "../../../redux/types/types";
-const ProfileDataForm=(props)=>{
+type PropsType={
+ profile: ProfileType
+}
+const ProfileDataForm:React.FC & PropsType>=(props)=>{
return