fix(graphql): fix sandbox csrf & role color/priority nullable (#1064)

This commit is contained in:
Kyrch
2026-01-27 19:58:47 -03:00
committed by GitHub
parent 1f815a6082
commit 45ea839c4e
4 changed files with 21 additions and 6 deletions
@@ -11,7 +11,7 @@ class RoleColorField extends StringField
{
public function __construct()
{
parent::__construct(Role::ATTRIBUTE_COLOR, nullable: false);
parent::__construct(Role::ATTRIBUTE_COLOR);
}
public function description(): string
@@ -11,7 +11,7 @@ class RolePriorityField extends IntField
{
public function __construct()
{
parent::__construct(Role::ATTRIBUTE_PRIORITY, nullable: false);
parent::__construct(Role::ATTRIBUTE_PRIORITY);
}
public function description(): string
+14
View File
@@ -1,3 +1,7 @@
<head>
<title>Sandbox</title>
<meta name="csrf-token" content="{{ csrf_token() }}">
</head>
<body style="margin: 0;">
<div style="width: 100%; height: 100%;" id='embedded-sandbox'></div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/v2/embeddable-sandbox.umd.production.min.js"></script>
@@ -5,6 +9,16 @@
new window.EmbeddedSandbox({
target: '#embedded-sandbox',
initialEndpoint: '{{ $endpoint }}',
handleRequest: (endpointUrl, options) => {
return fetch(endpointUrl, {
...options,
credentials: 'include',
headers: {
...options.headers,
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
},
});
},
});
</script>
</body>
+2 -1
View File
@@ -17,6 +17,7 @@ use Illuminate\Support\Facades\Route;
|
*/
Route::get('/sandbox', fn (): Factory|View => view('graphql.sandbox', [
Route::middleware('web')
->get('/sandbox', fn (): Factory|View => view('graphql.sandbox', [
'endpoint' => route('graphql'),
]));