refactors to avoid using useParams where possible

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-08-23 18:42:28 +02:00
parent c20c574a0a
commit 763fb81e82
9 changed files with 56 additions and 23 deletions
@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useParams } from 'react-router-dom';
import useAsync from 'react-use/lib/useAsync';
import { cloudbuildApiRef } from '../../api';
import { useApi } from '@backstage/core-plugin-api';
import { useApi, useRouteRefParams } from '@backstage/core-plugin-api';
import { buildRouteRef } from '../../routes';
export const useWorkflowRunsDetails = (projectId: string) => {
const api = useApi(cloudbuildApiRef);
const { id } = useParams();
const { id } = useRouteRefParams(buildRouteRef);
const details = useAsync(async () => {
return projectId
? api.getWorkflowRun({