Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat: connect channel

Nevo David1a2937b518be
diff --git a/apps/frontend/src/components/onboarding/connect.channels.tsx b/apps/frontend/src/components/onboarding/connect.channels.tsx
index 7dcaafd22..73b0d20e3 100644
--- a/apps/frontend/src/components/onboarding/connect.channels.tsx
+++ b/apps/frontend/src/components/onboarding/connect.channels.tsx
@@ -9,16 +9,13 @@ import clsx from 'clsx';
import Image from 'next/image';
import { Menu } from '@gitroom/frontend/components/launches/menu/menu';
import {
- AddProviderComponent,
ApiModal,
CustomVariables,
- UrlModal,
} from '@gitroom/frontend/components/launches/add.provider.component';
import { useRouter } from 'next/navigation';
import { useVariables } from '@gitroom/react/helpers/variable.context';
-import { string } from 'yup';
import { useToaster } from '@gitroom/react/toaster/toaster';
-import { useModals } from '@mantine/modals';
+import { Integration } from '@prisma/client';
export const ConnectChannels: FC = () => {
const fetch = useFetch();
@@ -27,7 +24,6 @@ export const ConnectChannels: FC = () => {
const [identifier, setIdentifier] = useState<any>(undefined);
const [popup, setPopups] = useState<undefined | string[]>(undefined);
const toaster = useToaster();
- const modal = useModals();
const [showCustom, setShowCustom] = useState<any>(undefined);
const getIntegrations = useCallback(async () => {
@@ -47,6 +43,22 @@ export const ConnectChannels: FC = () => {
// []
// );
+ const refreshChannel = useCallback(
+ (integration: Integration & { identifier: string }) => async () => {
+ const { url } = await (
+ await fetch(
+ `/integrations/social/${integration.identifier}?refresh=${integration.internalId}`,
+ {
+ method: 'GET',
+ }
+ )
+ ).json();
+
+ window.location.href = url;
+ },
+ []
+ );
+
const addMessage = useCallback(
(event: MessageEvent<{ msg: string; success: boolean }>) => {
if (!event.data.msg) {
@@ -346,6 +358,7 @@ export const ConnectChannels: FC = () => {
mutate={mutate}
onChange={update}
id={integration.id}
+ refreshChannel={refreshChannel}
canEnable={
user?.totalChannels! > totalNonDisabledChannels &&
integration.disabled