[FRONT COMPONENT] Add Front component token generation (#17855)
closes https://github.com/twentyhq/core-team-issues/issues/2180 https://github.com/user-attachments/assets/a898455d-eb1c-4d22-b585-785e98fc38a7
This commit is contained in:
+17
-4
@@ -7,7 +7,8 @@ import { createRemoteWorker } from '../worker/createRemoteWorker';
|
||||
|
||||
type FrontComponentWorkerEffectProps = {
|
||||
componentUrl: string;
|
||||
authToken: string;
|
||||
applicationAccessToken?: string;
|
||||
apiUrl?: string;
|
||||
frontComponentHostCommunicationApi: FrontComponentHostCommunicationApi;
|
||||
setReceiver: React.Dispatch<React.SetStateAction<RemoteReceiver | null>>;
|
||||
setThread: React.Dispatch<
|
||||
@@ -21,7 +22,8 @@ type FrontComponentWorkerEffectProps = {
|
||||
|
||||
export const FrontComponentWorkerEffect = ({
|
||||
componentUrl,
|
||||
authToken,
|
||||
applicationAccessToken,
|
||||
apiUrl,
|
||||
frontComponentHostCommunicationApi,
|
||||
setReceiver,
|
||||
setThread,
|
||||
@@ -58,7 +60,11 @@ export const FrontComponentWorkerEffect = ({
|
||||
setThread(thread);
|
||||
|
||||
thread.imports
|
||||
.render(newReceiver.connection, { componentUrl, authToken })
|
||||
.render(newReceiver.connection, {
|
||||
componentUrl,
|
||||
applicationAccessToken,
|
||||
apiUrl,
|
||||
})
|
||||
.catch((error: Error) => {
|
||||
setError(error);
|
||||
});
|
||||
@@ -69,7 +75,14 @@ export const FrontComponentWorkerEffect = ({
|
||||
setThread(null);
|
||||
worker.terminate();
|
||||
};
|
||||
}, [componentUrl, authToken, setError, setReceiver, setThread]);
|
||||
}, [
|
||||
componentUrl,
|
||||
applicationAccessToken,
|
||||
apiUrl,
|
||||
setError,
|
||||
setReceiver,
|
||||
setThread,
|
||||
]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user