feat: frontend slack integration (#932)
* feat: slack integration frontend * feat: slack integration frontend complete * Co-authored-by: Aaryan Khandelwal <aaryan610@users.noreply.github.com>
This commit is contained in:
parent
d99f669b89
commit
c80094581e
12 changed files with 308 additions and 31 deletions
|
|
@ -2,17 +2,24 @@ import { useRef, useState } from "react";
|
|||
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
const useIntegrationPopup = (provider: string | undefined) => {
|
||||
const useIntegrationPopup = (provider: string | undefined, stateParams?: string) => {
|
||||
const [authLoader, setAuthLoader] = useState(false);
|
||||
|
||||
const router = useRouter();
|
||||
const { workspaceSlug } = router.query;
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
const providerUrls: { [key: string]: string } = {
|
||||
github: `https://github.com/apps/${
|
||||
process.env.NEXT_PUBLIC_GITHUB_APP_NAME
|
||||
}/installations/new?state=${workspaceSlug as string}`,
|
||||
slack: "",
|
||||
}/installations/new?state=${workspaceSlug?.toString()}`,
|
||||
slack: `https://slack.com/oauth/v2/authorize?scope=chat%3Awrite%2Cim%3Ahistory%2Cim%3Awrite%2Clinks%3Aread%2Clinks%3Awrite%2Cusers%3Aread%2Cusers%3Aread.email&user_scope=&&client_id=${
|
||||
process.env.NEXT_PUBLIC_SLACK_CLIENT_ID
|
||||
}&state=${workspaceSlug?.toString()}`,
|
||||
slackChannel: `https://slack.com/oauth/v2/authorize?scope=incoming-webhook&client_id=${
|
||||
process.env.NEXT_PUBLIC_SLACK_CLIENT_ID
|
||||
}&state=${workspaceSlug?.toString()},${projectId?.toString()}${
|
||||
stateParams ? "," + stateParams : ""
|
||||
}`,
|
||||
};
|
||||
const popup = useRef<any>();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue