/api/ogp を /api/checkin/card に変更

This commit is contained in:
shibafu 2018-01-05 22:43:33 +09:00
parent 69f619e2af
commit f2ed4f85ee
3 changed files with 12 additions and 12 deletions

View File

@ -47,7 +47,7 @@
@endif @endif
<!-- okazu link --> <!-- okazu link -->
@if (!empty($ejaculation->link)) @if (!empty($ejaculation->link))
<div id="linkCard" class="card mb-2 w-50 d-none" style="font-size: small;"> <div class="card link-card mb-2 w-50 d-none" style="font-size: small;">
<a class="text-dark card-link" href="{{ $ejaculation->link }}"> <a class="text-dark card-link" href="{{ $ejaculation->link }}">
<img src="" alt="Thumbnail" class="card-img-top bg-secondary"> <img src="" alt="Thumbnail" class="card-img-top bg-secondary">
<div class="card-body"> <div class="card-body">
@ -104,21 +104,21 @@
form.submit(); form.submit();
}); });
var $linkCard = $('#linkCard'); $('.link-card').each(function () {
if ($linkCard.length > 0) { var $this = $(this);
$.ajax({ $.ajax({
url: '{{ url('/api/ogp') }}', url: '{{ url('/api/checkin/card') }}',
method: 'get', method: 'get',
type: 'json', type: 'json',
data: { data: {
url: $linkCard.find('a').attr('href') url: $this.find('a').attr('href')
} }
}).then(function (data) { }).then(function (data) {
$linkCard.find('.card-title').text(data.title); $this.find('.card-title').text(data.title);
$linkCard.find('.card-text').text(data.description); $this.find('.card-text').text(data.description);
$linkCard.find('img').attr('src', data.image); $this.find('img').attr('src', data.image);
$linkCard.removeClass('d-none'); $this.removeClass('d-none');
});
}); });
}
</script> </script>
@endpush @endpush

View File

@ -111,7 +111,7 @@
$('.link-card').each(function () { $('.link-card').each(function () {
var $this = $(this); var $this = $(this);
$.ajax({ $.ajax({
url: '{{ url('/api/ogp') }}', url: '{{ url('/api/checkin/card') }}',
method: 'get', method: 'get',
type: 'json', type: 'json',
data: { data: {

View File

@ -17,7 +17,7 @@ Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user(); return $request->user();
}); });
Route::get('/ogp', function (Request $request) { Route::get('/checkin/card', function (Request $request) {
$request->validate([ $request->validate([
'url:required|url' 'url:required|url'
]); ]);