Skip to content

Commit 8af5b05

Browse files
authored
Query examples: Authentication (reduxjs#1108)
1 parent bfdbfd2 commit 8af5b05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+35870
-2
lines changed

docs/rtk-query/usage/examples.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ There are several ways to handle authentication with RTK Query. This is a very b
7878
This example dispatches a `setCredentials` action to store the user and token information.
7979

8080
<iframe
81-
src="https://codesandbox.io/embed/rtk-query-authentication-example-zx8me?fontsize=12&hidenavigation=1&module=%2Fsrc%2Ffeatures%2Fauth%2FauthSlice.tsx&theme=dark&runonclick=1"
81+
src="https://codesandbox.io/embed/github/reduxjs/redux-toolkit/tree/feature/v1.6-integration/examples/query/react/authentication?fontsize=12&hidenavigation=1&module=%2Fsrc%2Ffeatures%2Fauth%2FauthSlice.tsx&theme=dark&runonclick=1"
8282
style={{
8383
width: '100%',
8484
height: '800px',
@@ -96,7 +96,7 @@ This example dispatches a `setCredentials` action to store the user and token in
9696
This example uses a matcher from the endpoint and `extraReducers` in the `authSlice`.
9797

9898
<iframe
99-
src="https://codesandbox.io/embed/rtk-query-authentication-example-extrareducers-5w7q9?fontsize=12&hidenavigation=1&module=%2Fsrc%2Ffeatures%2Fauth%2FauthSlice.tsx&theme=dark&runonclick=1"
99+
src="https://codesandbox.io/embed/github/reduxjs/redux-toolkit/tree/feature/v1.6-integration/examples/query/react/authentication-with-extrareducers?fontsize=12&hidenavigation=1&module=%2Fsrc%2Ffeatures%2Fauth%2FauthSlice.tsx&theme=dark&runonclick=1"
100100
style={{
101101
width: '100%',
102102
height: '800px',
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true

examples/query/react/authentication-with-extrareducers/package-lock.json

Lines changed: 17118 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "authentication-with-extrareducers",
3+
"version": "1.0.0",
4+
"description": "",
5+
"keywords": [],
6+
"main": "./src/index.tsx",
7+
"dependencies": {
8+
"@chakra-ui/react": "1.0.0",
9+
"@emotion/react": "^11.4.0",
10+
"@emotion/styled": "^11.3.0",
11+
"@reduxjs/toolkit": "^1.6.0-beta.0",
12+
"framer-motion": "^2.9.5",
13+
"msw": "0.28.2",
14+
"react": "17.0.2",
15+
"react-dom": "17.0.2",
16+
"react-icons": "3.11.0",
17+
"react-redux": "^7.2.4",
18+
"react-router-dom": "5.2.0",
19+
"react-scripts": "4.0.2"
20+
},
21+
"devDependencies": {
22+
"@types/react": "17.0.0",
23+
"@types/react-dom": "17.0.0",
24+
"@types/react-redux": "7.1.9",
25+
"@types/react-router-dom": "5.1.6",
26+
"typescript": "4.1.3"
27+
},
28+
"resolutions": {
29+
"@typescript-eslint/parser": "4.4.1"
30+
},
31+
"scripts": {
32+
"start": "react-scripts start",
33+
"build": "react-scripts build",
34+
"prebuild": "rm -rf dist/"
35+
},
36+
"eslintConfig": {
37+
"extends": [
38+
"react-app"
39+
]
40+
},
41+
"browserslist": [
42+
">0.2%",
43+
"not dead",
44+
"not ie <= 11",
45+
"not op_mini all"
46+
],
47+
"msw": {
48+
"workerDirectory": "public"
49+
}
50+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<!--
14+
manifest.json provides metadata used when your web app is installed on a
15+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16+
-->
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
22+
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>React App</title>
28+
</head>
29+
<body>
30+
<noscript>You need to enable JavaScript to run this app.</noscript>
31+
<div id="root"></div>
32+
<!--
33+
This HTML file is a template.
34+
If you open it directly in the browser, you will see an empty page.
35+
36+
You can add webfonts, meta tags, or analytics to this file.
37+
The build step will place the bundled scripts into the <body> tag.
38+
39+
To begin the development, run `npm start` or `yarn start`.
40+
To create a production bundle, use `npm run build` or `yarn build`.
41+
-->
42+
</body>
43+
</html>
44+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"short_name": "RTK Query Authentication using extraReducers Example",
3+
"name": "Authentication Example",
4+
"start_url": ".",
5+
"display": "standalone",
6+
"theme_color": "#000000",
7+
"background_color": "#ffffff"
8+
}

0 commit comments

Comments
 (0)