Skip to content

Commit

Permalink
Sets default img and functionality to upload img
Browse files Browse the repository at this point in the history
  • Loading branch information
NZAlona committed Jun 15, 2024
1 parent eda0e03 commit d811433
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
11 changes: 8 additions & 3 deletions src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,14 @@ export default function Header({ openSideBar, sideBarOpen }) {
<button className={css.button} onClick={() => openModal()}>
<span
className={`${css.avatarSmall} ${css.avatar}`}
style={{
backgroundImage: `url(${user.avatarURL})`,
}}
// style={{
// backgroundImage: `url(${user.avatarURL})`,
// }}
style={
user.avatarURL
? { backgroundImage: `url(${user.avatarURL})` }
: {}
}
/>
</button>
</div>
Expand Down
8 changes: 5 additions & 3 deletions src/components/UserEditModal/UserEditModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ export default function UserEditModal({ onClose }) {
<div className={css.avatarContainer}>
<span
className={`${css.avatarBig} ${css.avatar}`}
style={{
backgroundImage: `url(${user.avatarURL})`,
}}
style={
user.avatarURL
? { backgroundImage: `url(${user.avatarURL})` }
: {}
}
/>

<button
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserEditModal/UserEditModal.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

.plusBtn {
border: none;
background-color: #bedbb0;
background-color: var(--green);
border-radius: 4px;
width: 24px;
height: 24px;
Expand Down
7 changes: 0 additions & 7 deletions src/redux/auth/operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,10 @@ export const refreshUser = createAsyncThunk(
}
);

/*
* headers: Authorization: Bearer token
* body: {name, email, password }
*/
export const updateUserInfo = createAsyncThunk(
"user/updateUserInfo",
async (userData, thunkAPI) => {
try {
console.log(userData);
const reduxState = thunkAPI.getState();
const savedToken = reduxState.auth.token;
setAuthHeader(savedToken);
Expand All @@ -98,5 +93,3 @@ export const updateUserInfo = createAsyncThunk(
},
}
);

// export const updAvatarURL = createAction("updateAva");

0 comments on commit d811433

Please sign in to comment.