Try and get error messages working again
This commit is contained in:
parent
70d17006dd
commit
32b5b057fa
2 changed files with 8 additions and 12 deletions
|
@ -62,7 +62,7 @@ class MicropubClientController extends Controller
|
||||||
$this->indieClient
|
$this->indieClient
|
||||||
);
|
);
|
||||||
if (! $micropubEndpoint) {
|
if (! $micropubEndpoint) {
|
||||||
return redirect(route('micropub-client'))->withErrors('Unable to determine micropub API endpoint', 'endpoint');
|
return redirect(route('micropub-client'))->with('error', 'Unable to determine micropub API endpoint');
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->postNoteRequest($request, $micropubEndpoint, $token);
|
$response = $this->postNoteRequest($request, $micropubEndpoint, $token);
|
||||||
|
@ -76,7 +76,7 @@ class MicropubClientController extends Controller
|
||||||
return redirect($location);
|
return redirect($location);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect(route('micropub-client'))->withErrors('Endpoint didn’t create the note.', 'endpoint');
|
return redirect(route('micropub-client'))->with('error', 'Endpoint didn’t create the note.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,7 +95,7 @@ class MicropubClientController extends Controller
|
||||||
$token = $request->session()->get('token');
|
$token = $request->session()->get('token');
|
||||||
$micropubEndpoint = $this->indieAuthService->discoverMicropubEndpoint($domain, $this->indieClient);
|
$micropubEndpoint = $this->indieAuthService->discoverMicropubEndpoint($domain, $this->indieClient);
|
||||||
if (! $micropubEndpoint) {
|
if (! $micropubEndpoint) {
|
||||||
return redirect(route('micropub-client'))->withErrors('Unable to determine micropub API endpoint', 'endpoint');
|
return redirect(route('micropub-client'))->with('error', 'Unable to determine micropub API endpoint');
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -104,7 +104,7 @@ class MicropubClientController extends Controller
|
||||||
'query' => ['q' => 'syndicate-to'],
|
'query' => ['q' => 'syndicate-to'],
|
||||||
]);
|
]);
|
||||||
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
||||||
return redirect(route('micropub-client'))->withErrors('Bad response when refreshing syndication targets', 'endpoint');
|
return redirect(route('micropub-client'))->with('error', 'Bad response when refreshing syndication targets');
|
||||||
}
|
}
|
||||||
$body = (string) $response->getBody();
|
$body = (string) $response->getBody();
|
||||||
$syndication = $this->parseSyndicationTargets($body);
|
$syndication = $this->parseSyndicationTargets($body);
|
||||||
|
@ -178,8 +178,7 @@ class MicropubClientController extends Controller
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
]);
|
]);
|
||||||
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
|
||||||
return redirect(route('micropub-client'))
|
return redirect(route('micropub-client'))->with('error', 'There was a bad response from the micropub endpoint.');
|
||||||
->withErrors('There was a bad response from the micropub endpoint.', 'endpoint');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
|
@ -5,13 +5,10 @@ New Note «
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
@if (session('error'))
|
||||||
|
<p class="error">{{ session('error') }}</p>
|
||||||
|
@endif
|
||||||
<p>This is my UI for posting new notes, hopefully you’ll soon be able to use this if your site supports the micropub API.</p>
|
<p>This is my UI for posting new notes, hopefully you’ll soon be able to use this if your site supports the micropub API.</p>
|
||||||
@if($errors->endpoint->first() != '')
|
|
||||||
<p class="error">{{ $errors->endpoint->first() }}</p>
|
|
||||||
@endif
|
|
||||||
@if($errors->indieauth->first() != '')
|
|
||||||
<p class="error">{{ $errors->indieauth->first() }}</p>
|
|
||||||
@endif
|
|
||||||
@if($url === null)
|
@if($url === null)
|
||||||
<form action="{{ route('indieauth-start') }}" method="post">
|
<form action="{{ route('indieauth-start') }}" method="post">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||||
|
|
Loading…
Add table
Reference in a new issue