mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 12:59:14 +00:00
fix: apply chat console settings without refreshing the page
This commit is contained in:
parent
acf3663bd5
commit
eb38675ded
@ -11,6 +11,7 @@ import UiChatWidget from "hexabot-chat-widget/src/UiChatWidget";
|
|||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
|
|
||||||
import { getAvatarSrc } from "@/components/inbox/helpers/mapMessages";
|
import { getAvatarSrc } from "@/components/inbox/helpers/mapMessages";
|
||||||
|
import { useLoadSettings } from "@/hooks/entities/auth-hooks";
|
||||||
import { useAuth } from "@/hooks/useAuth";
|
import { useAuth } from "@/hooks/useAuth";
|
||||||
import { useConfig } from "@/hooks/useConfig";
|
import { useConfig } from "@/hooks/useConfig";
|
||||||
import i18n from "@/i18n/config";
|
import i18n from "@/i18n/config";
|
||||||
@ -23,6 +24,11 @@ export const ChatWidget = () => {
|
|||||||
const { apiUrl } = useConfig();
|
const { apiUrl } = useConfig();
|
||||||
const { isAuthenticated } = useAuth();
|
const { isAuthenticated } = useAuth();
|
||||||
const isVisualEditor = pathname === `/${RouterType.VISUAL_EDITOR}`;
|
const isVisualEditor = pathname === `/${RouterType.VISUAL_EDITOR}`;
|
||||||
|
const { data: settings } = useLoadSettings();
|
||||||
|
const key = JSON.stringify(
|
||||||
|
settings?.["console_channel"]?.find((s) => s.label === "allowed_domains")
|
||||||
|
?.value,
|
||||||
|
);
|
||||||
|
|
||||||
return isAuthenticated ? (
|
return isAuthenticated ? (
|
||||||
<Box
|
<Box
|
||||||
@ -31,6 +37,7 @@ export const ChatWidget = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<UiChatWidget
|
<UiChatWidget
|
||||||
|
key={key}
|
||||||
config={{
|
config={{
|
||||||
apiUrl,
|
apiUrl,
|
||||||
channel: "console-channel",
|
channel: "console-channel",
|
||||||
|
Loading…
Reference in New Issue
Block a user