Skip to content

Commit

Permalink
fix: adapt frontend to repository_url not being an array anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
ewan-escience committed Oct 18, 2022
1 parent 2a3ecf4 commit c4bb163
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion frontend/types/SoftwareTypes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2022 Christian Meeßen (GFZ) <christian.meessen@gfz-potsdam.de>
// SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all)
// SPDX-FileCopyrightText: 2022 Ewan Cahen (Netherlands eScience Center) <e.cahen@esciencecenter.nl>
// SPDX-FileCopyrightText: 2022 Helmholtz Centre Potsdam - GFZ German Research Centre for Geosciences
// SPDX-FileCopyrightText: 2022 Netherlands eScience Center
// SPDX-FileCopyrightText: 2022 dv4all
//
// SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -54,7 +56,7 @@ export type SoftwareItem = SoftwareTableItem & {
}

export type SoftwareItemFromDB = SoftwareTableItem & {
repository_url: RepositoryUrl[]
repository_url: RepositoryUrl
}

export type SoftwareListItem = {
Expand Down
8 changes: 5 additions & 3 deletions frontend/utils/editSoftware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all)
// SPDX-FileCopyrightText: 2022 Ewan Cahen (Netherlands eScience Center) <e.cahen@esciencecenter.nl>
// SPDX-FileCopyrightText: 2022 Netherlands eScience Center
// SPDX-FileCopyrightText: 2022 dv4all
//
// SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -65,9 +67,9 @@ export async function getSoftwareToEdit({slug, token, baseUrl}:
// fix repositoryUrl
const software: SoftwareItem = getPropsFromObject(data[0], SoftwarePropsToSave)
// repository url should at least be http://a.b
if (data[0]?.repository_url[0]?.url?.length > 9) {
software.repository_url = data[0]?.repository_url[0]?.url
software.repository_platform = data[0]?.repository_url[0]?.code_platform
if (data[0]?.repository_url?.url?.length > 9) {
software.repository_url = data[0]?.repository_url?.url
software.repository_platform = data[0]?.repository_url?.code_platform
} else {
software.repository_url = null
software.repository_platform = null
Expand Down

0 comments on commit c4bb163

Please sign in to comment.