openshift-assisted / assisted-installer-ui

The Assisted Installer User Interface
https://console.redhat.com/openshift/create/datacenter
Apache License 2.0
9 stars 36 forks source link

Update setAuthInterceptor to be idempotent #2454

Closed rh-gvincent closed 8 months ago

rh-gvincent commented 9 months ago

Today if we call setAuthInterceptor multiple times, it's not working because we reuse previous client and clientWithoutCaseConverter. Config url in withAssistedInstallerBasePath for example is applied multiple times.

Normally we call setAuthInterceptor only one time. But with recent module federated code, we call setAuthInterceptor every time we load the component. We also remove the job template created earlier

openshift-ci[bot] commented 9 months ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ammont82, rh-gvincent

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/openshift-assisted/assisted-installer-ui/blob/master/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
rh-gvincent commented 9 months ago
useEffect(() => {
  auth
    .getUser()
    .then(() => auth.getToken())
    .then((token) => {
      Api.setAuthInterceptor(...);
    })
    .finally(() => setIsLoading(false));
}, []);

code we use in federated modules when we reuse the setAuthInterceptor