Skip to content

Commit

Permalink
Studio: Translate Studio Assistant Welcome messages (#483)
Browse files Browse the repository at this point in the history
* Remove locale parameter from welcome endpoint

---------

Co-authored-by: Kateryna Kodonenko <kateryna@automattic.com>
  • Loading branch information
katinthehatsite and Kateryna Kodonenko authored Aug 21, 2024
1 parent d22b590 commit 6e84021
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/hooks/use-welcome-messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
useCallback,
useContext,
} from 'react';
import { getAppGlobals } from '../lib/app-globals';
import { useAuth } from './use-auth';
import { useOffline } from './use-offline';
import { useWindowListener } from './use-window-listener';
Expand All @@ -31,7 +30,6 @@ const WelcomeMessagesContext = createContext< WelcomeMessagesContext >( {
export const WelcomeMessagesProvider = ( { children }: { children: React.ReactNode } ) => {
const { client } = useAuth();
const isOffline = useOffline();
const locale = getAppGlobals().locale;
const [ messages, setMessages ] = useState< string[] >( [] );
const [ examplePrompts, setExamplePrompts ] = useState< string[] >( [] );
const isFetchingMessages = useRef( false );
Expand All @@ -45,9 +43,7 @@ export const WelcomeMessagesProvider = ( { children }: { children: React.ReactNo
const response = await client.req.get( {
path: '/studio-app/ai-assistant/welcome',
apiNamespace: 'wpcom/v2',
params: { locale },
} );

const data = response as WelcomeMessageResponse;
if ( data ) {
setMessages( data.messages );
Expand All @@ -59,7 +55,7 @@ export const WelcomeMessagesProvider = ( { children }: { children: React.ReactNo
} finally {
isFetchingMessages.current = false;
}
}, [ client, isOffline, locale ] );
}, [ client, isOffline ] );

useEffect( () => {
fetchMessages();
Expand Down

0 comments on commit 6e84021

Please sign in to comment.