feat: add party user metadata storage and display support, including storage API, Redux actions, state management, and UI updates for profile page

This commit is contained in:
louiscklaw
2025-06-18 01:14:37 +08:00
parent c93b31b2f6
commit 215476cfaa
6 changed files with 55 additions and 14 deletions

View File

@@ -19,7 +19,12 @@ import {
IonToast,
} from '@ionic/react';
import './Login.scss';
import { setIsLoggedIn, setUsername, setData } from '../../data/user/user.actions';
import {
setIsLoggedIn,
setUsername,
setData,
setPartyUserMeta,
} from '../../data/user/user.actions';
import { connect } from '../../data/connect';
import { RouteComponentProps } from 'react-router';
import { chevronBackOutline } from 'ionicons/icons';
@@ -39,6 +44,7 @@ interface DispatchProps {
setIsLoggedIn: typeof setIsLoggedIn;
setUsername: typeof setUsername;
setData: typeof setData;
setPartyUserMeta: typeof setPartyUserMeta;
}
interface LoginProps extends OwnProps, DispatchProps {}
@@ -48,6 +54,7 @@ const Login: React.FC<LoginProps> = ({
history,
setUsername: setUsernameAction,
setData,
setPartyUserMeta,
}) => {
const [username, setUsername] = useState('demo@minimals.cc');
const [email, setEmail] = useState('demo@minimals.cc');
@@ -76,7 +83,8 @@ const Login: React.FC<LoginProps> = ({
if (status == 200) {
// if username and password ok
setData({ isLoggedin: true, accessToken, ...user });
setData({ isLoggedin: true, accessToken });
setPartyUserMeta(user);
await setIsLoggedIn(true);
await setUsernameAction(username);
@@ -192,6 +200,7 @@ export default connect<OwnProps, StateProps, DispatchProps>({
setIsLoggedIn,
setUsername,
setData,
setPartyUserMeta,
},
mapStateToProps: (state) => ({
partyUserState: selectors.getPartyUserState(state),