-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send cookies with red bubble request so backend can check for dismiss…
…al cookies
- Loading branch information
1 parent
357f75b
commit b7140d6
Showing
12 changed files
with
76 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
projects/packages/my-jetpack/_inc/data/use-red-bubble-query.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { QUERY_RED_BUBBLE_ALERTS_KEY, REST_API_RED_BUBBLE_ALERTS } from './constants'; | ||
import useSimpleQuery from './use-simple-query'; | ||
|
||
const useRedBubbleQuery = () => { | ||
const dismissalCookies = document.cookie | ||
.split( ';' ) | ||
.map( cookie => cookie.trim() ) | ||
.filter( cookie => cookie.includes( '_dismissed' ) ); | ||
|
||
const { data, isLoading, isError } = useSimpleQuery< RedBubbleAlerts >( { | ||
name: QUERY_RED_BUBBLE_ALERTS_KEY, | ||
query: { | ||
path: REST_API_RED_BUBBLE_ALERTS, | ||
method: 'POST', | ||
data: { dismissal_cookies: dismissalCookies }, | ||
}, | ||
} ); | ||
|
||
return { | ||
data, | ||
isLoading, | ||
isError, | ||
}; | ||
}; | ||
|
||
export default useRedBubbleQuery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
projects/packages/my-jetpack/_inc/utils/cookies/check-for-cookie.ts
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters