Skip to content

Commit

Permalink
Merge pull request #100 from hommingcom/master
Browse files Browse the repository at this point in the history
Fix id navigation and add quality-of-life configuration options
  • Loading branch information
kevincobain2000 authored Oct 26, 2022
2 parents b8bef51 + 92fd95f commit d3c6e4a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
14 changes: 14 additions & 0 deletions config/request-docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@
// \App\Http\Middleware\NotFoundWhenProduction::class,
],

/*
* Default headers shown on the request headers editor
*/
'default_request_headers' => [
'Accept' => 'application/json',
'X-CSRF-TOKEN' => '',
'Authorization' => 'Bearer',
],

/*
* Show development relevant metadata on endpoints
*/
'show_development_metadata' => true,

/**
* Path to to static HTML if using command line.
*/
Expand Down
8 changes: 4 additions & 4 deletions resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,11 @@ class="inline-flex text-xs"
{{$doc['methods'][0]}}
</span>
<span class="">
<a href="#{{$doc['uri']}}">{{$doc['uri']}}</a>
<a href="#{{$doc['httpMethod'] .'-'. $doc['uri']}}">{{$doc['uri']}}</a>
</span>
</h1>
</div>
@if (config('request-docs.show_development_metadata'))
<table class="table-fixed text-sm mt-5">
<tbody>
<tr>
Expand Down Expand Up @@ -244,6 +245,7 @@ class="inline-flex text-xs"
@endforeach
</tbody>
</table>
@endif
<div v-if="docs[{{$index}}]['docBlock']" class="border-2 mr-4 mt-4 p-4 rounded text-sm">
<h3 class="font-bold">Description</h3>
<hr>
Expand Down Expand Up @@ -660,9 +662,7 @@ class="my-prism-editor"
filterTerm: ''
},
created: function () {
axios.defaults.headers.common['X-CSRF-TOKEN'] = document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
axios.defaults.headers.common['Authorization'] = 'Bearer '
this.requestHeaders = JSON.stringify(axios.defaults.headers.common, null, 2)
this.requestHeaders = JSON.stringify({!! json_encode(config('request-docs.default_request_headers')) !!}, null, 2)
},
methods: {
highlightSidebar(idx) {
Expand Down

0 comments on commit d3c6e4a

Please sign in to comment.