diff options
| author | Ivan Chen <ivan@thetaggid.com> | 2020-12-08 23:17:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-08 23:17:23 -0500 |
| commit | 792115326fc6af583f422082537885bc8061d051 (patch) | |
| tree | c397e80a5573cd791c45cc006b36570efa91d73c /src/store/actions | |
| parent | 84616a6143fea58899eafa915a73592eaad25361 (diff) | |
[TMA-410] Edit Non-Integrated Socials (#126)
* removed refs, added KB avoidance, UI done
* missed some things
* now parsing response correctly from backend
* fixed naming
* now allow empty strings to un-link a social
* hide field if empty, allow empty string, fixed taggs bar not updating bug
* Fix bug where non integrated socials do not show up on edit profile page
Co-authored-by: Ashm Walia <40498934+ashmgarv@users.noreply.github.com>
Co-authored-by: Ashm Walia <ashmwalia@outlook.com>
Diffstat (limited to 'src/store/actions')
| -rw-r--r-- | src/store/actions/user.ts | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/store/actions/user.ts b/src/store/actions/user.ts index 09ec8abf..e77b8513 100644 --- a/src/store/actions/user.ts +++ b/src/store/actions/user.ts @@ -2,7 +2,7 @@ import {RootState} from '../rootReducer'; import {UserType} from '../../types/types'; import {loadProfileInfo, loadAvatar, loadCover} from '../../services'; import {Action, ThunkAction} from '@reduxjs/toolkit'; -import {userLoggedIn, userDetailsFetched} from '../reducers'; +import {userLoggedIn, userDetailsFetched, socialEdited} from '../reducers'; import {getTokenOrLogout} from '../../utils'; /** @@ -38,6 +38,28 @@ export const loadUserData = ( } }; +/** + * To update editable socials + * @param social social to be updated + * @param value username of social to be updated + */ +export const updateSocial = ( + social: string, + value: string, +): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async ( + dispatch, +) => { + try { + console.log(social); + dispatch({ + type: socialEdited.type, + payload: {social, value}, + }); + } catch (error) { + console.log(error); + } +}; + export const logout = (): ThunkAction< Promise<void>, RootState, |
