mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 07:26:45 +00:00
misc: added proper error message hints
This commit is contained in:
@@ -125,7 +125,11 @@ export const slackServiceFactory = ({
|
|||||||
|
|
||||||
if (!slackClientId || !slackClientSecret) {
|
if (!slackClientId || !slackClientSecret) {
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
message: "Invalid slack configuration"
|
message: `Invalid Slack configuration. ${
|
||||||
|
appCfg.isCloud
|
||||||
|
? "Please contact the Infisical team."
|
||||||
|
: "Contact your instance admin to setup Slack integration in the Admin settings."
|
||||||
|
}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-5
@@ -2,6 +2,7 @@ import { useRouter } from "next/router";
|
|||||||
import { faSlack } from "@fortawesome/free-brands-svg-icons";
|
import { faSlack } from "@fortawesome/free-brands-svg-icons";
|
||||||
import { faEllipsis, faGear, faPlus } from "@fortawesome/free-solid-svg-icons";
|
import { faEllipsis, faGear, faPlus } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import axios from "axios";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import { createNotification } from "@app/components/notifications";
|
import { createNotification } from "@app/components/notifications";
|
||||||
@@ -71,12 +72,21 @@ export const OrgWorkflowIntegrationTab = withPermission(
|
|||||||
|
|
||||||
const triggerReinstall = async (platform: WorkflowIntegrationPlatform, id: string) => {
|
const triggerReinstall = async (platform: WorkflowIntegrationPlatform, id: string) => {
|
||||||
if (platform === WorkflowIntegrationPlatform.SLACK) {
|
if (platform === WorkflowIntegrationPlatform.SLACK) {
|
||||||
const slackReinstallUrl = await fetchSlackReinstallUrl({
|
try {
|
||||||
slackIntegrationId: id
|
const slackReinstallUrl = await fetchSlackReinstallUrl({
|
||||||
});
|
slackIntegrationId: id
|
||||||
|
});
|
||||||
|
|
||||||
if (slackReinstallUrl) {
|
if (slackReinstallUrl) {
|
||||||
router.push(slackReinstallUrl);
|
router.push(slackReinstallUrl);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
if (axios.isAxiosError(err)) {
|
||||||
|
createNotification({
|
||||||
|
text: (err.response?.data as { message: string })?.message,
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+18
-6
@@ -2,6 +2,7 @@ import { useEffect } from "react";
|
|||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import axios from "axios";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { createNotification } from "@app/components/notifications";
|
import { createNotification } from "@app/components/notifications";
|
||||||
@@ -51,12 +52,23 @@ export const SlackIntegrationForm = ({ id, onClose }: Props) => {
|
|||||||
|
|
||||||
const triggerSlackInstall = async (slug: string, description?: string) => {
|
const triggerSlackInstall = async (slug: string, description?: string) => {
|
||||||
setIsConnectLoading.on();
|
setIsConnectLoading.on();
|
||||||
const slackInstallUrl = await fetchSlackInstallUrl({
|
try {
|
||||||
slug,
|
const slackInstallUrl = await fetchSlackInstallUrl({
|
||||||
description
|
slug,
|
||||||
});
|
description
|
||||||
if (slackInstallUrl) {
|
});
|
||||||
router.push(slackInstallUrl);
|
if (slackInstallUrl) {
|
||||||
|
router.push(slackInstallUrl);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
if (axios.isAxiosError(err)) {
|
||||||
|
createNotification({
|
||||||
|
text: (err.response?.data as { message: string })?.message,
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setIsConnectLoading.off();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user