I have Laravel API + NextJs application with Sanctum authentication.
With Sanctum before sending request to the route, you need to send a request to /sanctum/csrf-cookie 'to initialize csrf protection'.
Here i how my RTK Query API looks:

Here is how the functions are called:

The logic works fine but i wanted to use only RTK Query and not depend on axios. Also, is there any way to handle getting the csrf-cookie and send it during the request from createAPI()?