Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 7fe5a00

Browse files
committed
chore: removing favorite action when user is logged out
1 parent 365ecd7 commit 7fe5a00

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222
"framer-motion": "4.1.17",
2323
"lenses-ppx": "6.1.10",
2424
"localforage": "1.10.0",
25+
"mitt": "3.0.0",
2526
"postcss": "8.3.5",
2627
"qs": "6.10.1",
2728
"react": "17.0.2",
2829
"react-content-loader": "6.0.3",
2930
"react-dom": "17.0.2",
3031
"react-paginate": "8.0.0",
3132
"react-query": "3.19.2",
32-
"react-use": "17.2.4",
33+
"react-use": "17.3.1",
3334
"reschema": "2.0.3",
3435
"rescript": "9.1.3",
3536
"rescript-polished": "^1.15.0",

src/App.res

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ module Main = {
2020
let make = () => {
2121
let route = Router.useRouter()
2222

23-
<ReactQuery.Provider client={queryClient}>
24-
{switch route {
25-
| Signin => <Signin />
26-
| Signup => <Signup />
27-
| _ => <Main />
28-
}}
29-
</ReactQuery.Provider>
23+
<UseAuthHook.Provider>
24+
<ReactQuery.Provider client={queryClient}>
25+
{switch route {
26+
| Signin => <Signin />
27+
| Signup => <Signup />
28+
| _ => <Main />
29+
}}
30+
</ReactQuery.Provider>
31+
</UseAuthHook.Provider>
3032
}

src/lib/query-client/QueryClient.res

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ let apiUrl = "https://conduit-api-fp.herokuapp.com/api"
44

55
let validateRequestError = response => {
66
switch response->Fetch.Response.status {
7-
| 401 => LocalForage.clear()->ignore
7+
| 401 => {
8+
UseAuthHook.emitter->Mitt.emit(UseAuthHook.unauthorizedEvent)
9+
LocalForage.clear()->ignore
10+
}
811
| _ => ()
912
}
1013
switch response->Fetch.Response.ok {

yarn.lock

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7553,6 +7553,11 @@ mississippi@^3.0.0:
75537553
stream-each "^1.1.0"
75547554
through2 "^2.0.0"
75557555

7556+
7557+
version "3.0.0"
7558+
resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.0.tgz#69ef9bd5c80ff6f57473e8d89326d01c414be0bd"
7559+
integrity sha512-7dX2/10ITVyqh4aOSVI9gdape+t9l2/8QxHrFmUXu4EEUpdlxl6RudZUPZoc+zuY2hk1j7XxVroIVIan/pD/SQ==
7560+
75567561
mixin-deep@^1.2.0:
75577562
version "1.3.2"
75587563
resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"
@@ -8884,10 +8889,10 @@ react-universal-interface@^0.6.2:
88848889
resolved "https://registry.yarnpkg.com/react-universal-interface/-/react-universal-interface-0.6.2.tgz#5e8d438a01729a4dbbcbeeceb0b86be146fe2b3b"
88858890
integrity sha512-dg8yXdcQmvgR13RIlZbTRQOoUrDciFVoSBZILwjE2LFISxZZ8loVJKAkuzswl5js8BHda79bIb2b84ehU8IjXw==
88868891

8887-
react-use@17.2.4:
8888-
version "17.2.4"
8889-
resolved "https://registry.yarnpkg.com/react-use/-/react-use-17.2.4.tgz#1f89be3db0a8237c79253db0a15e12bbe3cfeff1"
8890-
integrity sha512-vQGpsAM0F5UIlshw5UI8ULGPS4yn5rm7/qvn3T1Gnkrz7YRMEEMh+ynKcmRloOyiIeLvKWiQjMiwRGtdbgs5qQ==
8892+
react-use@17.3.1:
8893+
version "17.3.1"
8894+
resolved "https://registry.yarnpkg.com/react-use/-/react-use-17.3.1.tgz#12b248555775519aa2b900b22f1928d029bf99d1"
8895+
integrity sha512-hs7+tS4rRm1QLHPfanLCqXIi632tP4V7Sai1ENUP2WTufU6am++tU9uSw9YrNCFqbABiEv0ndKU1XCUcfu2tXA==
88918896
dependencies:
88928897
"@types/js-cookie" "^2.2.6"
88938898
"@xobotyi/scrollbar-width" "^1.9.5"

0 commit comments

Comments
 (0)