Bladeren bron

Remove `csrf_cookie_name`

shalvah 3 jaren geleden
bovenliggende
commit
249e6e696e

+ 1 - 6
config/scribe.php

@@ -187,7 +187,7 @@ return [
         'base_url' => null,
 
         /**
-         * Fetch a CSRF token before each request. Needed if you're using Laravel Sanctum.
+         * Fetch a CSRF token before each request, and add it as an X-XSRF-TOKEN header. Needed if you're using Laravel Sanctum.
          */
         'use_csrf' => false,
 
@@ -195,11 +195,6 @@ return [
          * The URL to fetch the CSRF token from (if `use_csrf` is true).
          */
         'csrf_url' => '/sanctum/csrf-token',
-
-        /**
-         * The name of the cookie to fetch the CSRF token from after hitting the `csrf_url`.
-         */
-        'csrf_cookie_name' => 'XSRF-TOKEN',
     ],
 
     /*

+ 1 - 1
resources/js/tryitout.js

@@ -227,7 +227,7 @@ async function executeTryOut(endpointId, form) {
     let preflightPromise = Promise.resolve();
     if (window.useCsrf && window.csrfUrl) {
         preflightPromise = makeAPICall('GET', window.csrfUrl, {}, {}, {}, null).then(() => {
-            headers['X-XSRF-TOKEN'] = getCookie(window.csrfCookieName);
+            headers['X-XSRF-TOKEN'] = getCookie('XSRF-TOKEN');
         });
     }
 

+ 0 - 1
resources/views/themes/default/index.blade.php

@@ -26,7 +26,6 @@
         var baseUrl = "{{ $tryItOut['base_url'] ?? config('app.url') }}";
         var useCsrf = Boolean({{ $tryItOut['use_csrf'] ?? null }});
         var csrfUrl = "{{ $tryItOut['csrf_url'] ?? null }}";
-        var csrfCookieName = "{{ $tryItOut['csrf_cookie_name'] ?? "XSRF-TOKEN" }}";
     </script>
     <script src="{{ u::getVersionedAsset($assetPathPrefix.'js/tryitout.js') }}"></script>
 @endif

+ 1 - 1
src/Commands/GenerateDocumentation.php

@@ -120,7 +120,7 @@ class GenerateDocumentation extends Command
         $changes = $upgrader->dryRun();
         if (!empty($changes)) {
             $this->newLine();
-            sleep(0.4);
+
             $this->warn("You're using an updated version of Scribe, which added new items to the config file.");
             $this->info("Here are the changes:");
             foreach ($changes as $change) {