mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
fix(graphql): fix sandbox csrf & role color/priority nullable (#1064)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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'),
|
||||
]));
|
||||
|
||||
Reference in New Issue
Block a user