-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[Demo] Fix demos with MSW #10920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Demo] Fix demos with MSW #10920
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT?
import { withSupabaseFilterAdapter } from './internal/supabaseAdapter'; | ||
|
||
const baseDataProvider = simpleRestProvider('http://localhost:4000'); | ||
const baseDataProvider = simpleRestProvider('https://localhost:4000'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is never accessed anyway, why not even put something that looks like a real api?
const baseDataProvider = simpleRestProvider('https://localhost:4000'); | |
const baseDataProvider = simpleRestProvider('https://crm.api.marmelab.com'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it but wasn't sure that it was a good idea, but let's try it!
const dataProvider = buildApolloClient({ | ||
clientOptions: { | ||
uri: 'http://localhost:4000/graphql', | ||
uri: 'https://localhost:4000/graphql', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for those?
uri: 'https://localhost:4000/graphql', | |
uri: 'https://ecommerce.api.marmelab.com/graphql', |
import simpleRestProvider from 'ra-data-simple-rest'; | ||
|
||
export default simpleRestProvider('http://localhost:4000'); | ||
export default simpleRestProvider('https://localhost:4000'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export default simpleRestProvider('https://localhost:4000'); | |
export default simpleRestProvider('https://ecommerce.api.marmelab.com/graphql'); |
examples/demo/src/fakeServer/rest.ts
Outdated
const data = generateData(); | ||
const adapter = new MswAdapter({ | ||
baseUrl: 'http://localhost:4000', | ||
baseUrl: 'https://localhost:4000', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
baseUrl: 'https://localhost:4000', | |
baseUrl: 'https://ecommerce.api.marmelab.com/graphql', |
} | ||
const worker = setupWorker(http.all(/http:\/\/localhost:4000/, fakeServer)); | ||
const worker = setupWorker( | ||
http.all(/https:\/\/localhost:4000/, fakeServer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http.all(/https:\/\/localhost:4000/, fakeServer) | |
http.all(/https:\/\/ecommerce\.api\.marmelab\.com:4000/, fakeServer) |
|
||
const handler = getMswHandler({ | ||
baseUrl: 'http://localhost:4000', | ||
baseUrl: 'https://localhost:4000', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
baseUrl: 'https://localhost:4000', | |
baseUrl: 'https://crm.api.marmelab.com', |
}); | ||
export const worker = setupWorker(http.all(/http:\/\/localhost:4000/, handler)); | ||
export const worker = setupWorker( | ||
http.all(/https:\/\/localhost:4000/, handler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http.all(/https:\/\/localhost:4000/, handler) | |
http.all(/https:\/\/crm\.api\.marmelab\.com:4000/, handler) |
Problem
Demo / CRM examples are not working in production when using Safari.
Solution
Use https://crm.api.marmelab.com / https://demo.api.marmelab.com instead of http://localhost:4000 for the fake server handled by MSW.
How To Test
Visit https://marmelab.com/react-admin-crm and https://marmelab.com/react-admin-demo with Safari.
Additional Checks
master
for a bugfix or a documentation fix, ornext
for a feature[ ] The PR includes unit tests (if not possible, describe why)[ ] The PR includes one or several stories (if not possible, describe why)