fix(dashboard): add organizationId to the webhook url
This commit is contained in:
@@ -235,12 +235,21 @@ export async function wsIntegrationsSlack(
|
|||||||
};
|
};
|
||||||
}>,
|
}>,
|
||||||
) {
|
) {
|
||||||
|
const { organizationId } = req.query;
|
||||||
|
|
||||||
|
if (!organizationId) {
|
||||||
|
connection.socket.send('No organizationId provided');
|
||||||
|
connection.socket.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const subscribeToEvent = 'integrations:slack';
|
const subscribeToEvent = 'integrations:slack';
|
||||||
|
|
||||||
getRedisSub().subscribe(subscribeToEvent);
|
getRedisSub().subscribe(subscribeToEvent);
|
||||||
const onMessage = (channel: string, message: string) => {
|
const onMessage = (channel: string, message: string) => {
|
||||||
if (channel === subscribeToEvent) {
|
if (channel === subscribeToEvent) {
|
||||||
const parsed = getSuperJson<{ organizationId: string }>(message);
|
const parsed = getSuperJson<{ organizationId: string }>(message);
|
||||||
if (parsed && parsed.organizationId === req.query.organizationId) {
|
if (parsed && parsed.organizationId === organizationId) {
|
||||||
connection.socket.send(message);
|
connection.socket.send(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,9 @@ import { InputWithLabel } from '@/components/forms/input-with-label';
|
|||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { useAppParams } from '@/hooks/useAppParams';
|
import { useAppParams } from '@/hooks/useAppParams';
|
||||||
import useWS from '@/hooks/useWS';
|
import useWS from '@/hooks/useWS';
|
||||||
import { popModal } from '@/modals';
|
|
||||||
import { type RouterOutputs, api } from '@/trpc/client';
|
import { type RouterOutputs, api } from '@/trpc/client';
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import { zCreateSlackIntegration } from '@openpanel/validation';
|
import { zCreateSlackIntegration } from '@openpanel/validation';
|
||||||
import { useQueryClient } from '@tanstack/react-query';
|
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
@@ -23,8 +21,7 @@ export function SlackIntegrationForm({
|
|||||||
}) {
|
}) {
|
||||||
const popup = useRef<Window | null>(null);
|
const popup = useRef<Window | null>(null);
|
||||||
const { organizationId } = useAppParams();
|
const { organizationId } = useAppParams();
|
||||||
const client = useQueryClient();
|
useWS(`/live/integrations/slack?organizationId=${organizationId}`, (res) => {
|
||||||
useWS('/live/integrations/slack', (res) => {
|
|
||||||
if (popup.current) {
|
if (popup.current) {
|
||||||
popup.current.close();
|
popup.current.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user