feat: ajoute la possibilité de désactiver les websockets
This commit is contained in:
@@ -16,3 +16,6 @@ NEXT_PUBLIC_DIRECTUS_API_WS_URL=$DIRECTUS_API_WS_URL
|
|||||||
|
|
||||||
# COMMENTS
|
# COMMENTS
|
||||||
COMMENTS_PER_PAGE=5
|
COMMENTS_PER_PAGE=5
|
||||||
|
|
||||||
|
# WEBSOCKET
|
||||||
|
NEXT_PUBLIC_DISABLE_WEBSOCKET=false
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {createDirectus, realtime, staticToken} from '@directus/sdk'
|
|||||||
import ConfirmationAlert from './confirmation-alert.js'
|
import ConfirmationAlert from './confirmation-alert.js'
|
||||||
|
|
||||||
const apiUrl = process.env.DIRECTUS_API_URL || process.env.NEXT_PUBLIC_DIRECTUS_API_URL
|
const apiUrl = process.env.DIRECTUS_API_URL || process.env.NEXT_PUBLIC_DIRECTUS_API_URL
|
||||||
|
const disableWebSocket = process.env.NEXT_PUBLIC_DISABLE_WEBSOCKET === 'true'
|
||||||
|
|
||||||
const LightTooltip = styled(({className, ...props}) => (
|
const LightTooltip = styled(({className, ...props}) => (
|
||||||
<Tooltip {...props} classes={{popper: className}} />
|
<Tooltip {...props} classes={{popper: className}} />
|
||||||
@@ -40,6 +41,10 @@ export default function Sign({session, navButton}) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let cleanup = () => {}
|
let cleanup = () => {}
|
||||||
|
|
||||||
|
if (disableWebSocket) {
|
||||||
|
return () => cleanup()
|
||||||
|
}
|
||||||
|
|
||||||
if (session?.user?.accessToken) {
|
if (session?.user?.accessToken) {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user