This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios' | |
import { useEffect, useReducer, useState } from 'react' | |
const initialResponse = { response: null, error: null, loading: false } | |
function responseReducer(state, action) { | |
switch (action.type) { | |
case 'INIT': | |
return { response: null, error: null, loading: true } | |
case 'SUCCESS': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IProfilePageProps { | |
appStore?: AppStore; | |
profileStore?: ProfileStore; | |
} | |
@inject('appStore', 'profileStore') @observer | |
class ProfileForm extends React.Component<FormikProps<any> & IProfilePageProps, {}> { | |
public componentDidMount() { | |
this.props.appStore.setPageTitle('Profile', 'View and edit your personal details'); | |
if (this.props.profileStore.profile.loading) { |