Skip to content

Commit

Permalink
chore(service-messages): migrate to new api and hub (#846)
Browse files Browse the repository at this point in the history
Co-authored-by: Christopher Berge Hove <[email protected]>
Co-authored-by: Noggling <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2024
1 parent e763969 commit 1cbc59e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/pr-846-2155757224.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

---
"fusion-project-portal": patch
---
Update url to the service message service
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ export function createPortalFramework(portalConfig: PortalConfig) {
/** Enabling signal-r module for portal used for service messages */
enableSignalR(
config,
'portal',
'servicemessages',
signalRConfigurator({
name: 'portal',
name: 'servicemessages',
service: 'portal',
path: '/signalr/hubs/portal/?negotiateVersion=1',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const ServiceMessageProvider: FC<PropsWithChildren> = ({ children }) => {
serviceMessages.next(data);
}, [data]);

const topic = useSignalR<unknown[]>('portal', 'service-messages');
const topic = useSignalR<unknown[]>('servicemessages', 'service-messages');

useLayoutEffect(() => {
const sub = topic.pipe(map((x) => x.shift() as ServiceMessage[])).subscribe(serviceMessages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { useQuery } from 'react-query';
import { ServiceMessage } from '../types/types';

export async function getActiveServiceMessages(client: IHttpClient): Promise<ServiceMessage[]> {
const res = await client.fetch(`/api/service-messages/active`);
const res = await client.fetch(`/service-messages/active`);
if (!res.ok) throw res;
return (await res.json()) as ServiceMessage[];
}

export const useServiceMessageQuery = () => {
const client = useFramework().modules.serviceDiscovery.createClient('portal');
const client = useFramework().modules.serviceDiscovery.createClient('service-messages');

return useQuery({
queryKey: ['service-message'],
Expand Down

0 comments on commit 1cbc59e

Please sign in to comment.