Show success message to the user

This commit is contained in:
Dane Everitt 2019-06-11 23:19:43 -07:00
parent 435626f4b7
commit 19ef901768
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 8 additions and 8 deletions

View file

@ -33,10 +33,11 @@ class ForgotPasswordController extends Controller
/**
* Get the response for a successful password reset link.
*
* @param \Illuminate\Http\Request $request
* @param string $response
* @return \Illuminate\Http\JsonResponse
*/
protected function sendResetLinkResponse($response): JsonResponse
protected function sendResetLinkResponse(Request $request, $response): JsonResponse
{
return response()->json([
'status' => trans($response),

View file

@ -1,9 +1,9 @@
import http from '@/api/http';
export default (email: string): Promise<void> => {
export default (email: string): Promise<string> => {
return new Promise((resolve, reject) => {
http.post('/auth/password', { email })
.then(() => resolve())
.then(response => resolve(response.data.status || ''))
.catch(reject);
});
};

View file

@ -33,13 +33,12 @@ class ForgotPasswordContainer extends React.PureComponent<Props, State> {
this.setState({ isSubmitting: true }, () => {
this.props.clearAllFlashMessages();
requestPasswordResetEmail(this.state.email)
.then(() => {
// @todo actually handle this.
})
.then(response => this.props.pushFlashMessage({
type: 'success', title: 'Success', message: response,
}))
.catch(error => {
console.error(error);
this.props.pushFlashMessage({
id: 'auth:forgot-password',
type: 'error',
title: 'Error',
message: httpErrorToHuman(error),