-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added call to update DOI when submitted * Added call to update DOI to submit button * Linting * Refactored DOI update logic to a util --------- Co-authored-by: Matthew Foster <[email protected]>
- Loading branch information
1 parent
28335e7
commit 7cccb26
Showing
5 changed files
with
93 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import recordToDataCite from "./recordToDataCite"; | ||
import firebase from "../firebase"; | ||
import {getAuthHash} from "./firebaseEnableDoiCreation"; | ||
|
||
async function performUpdateDraftDoi(record, region, language) { | ||
const dataciteAuthHash = await getAuthHash(region); | ||
|
||
const mappedDataCiteObject = recordToDataCite(record, language, region); | ||
delete mappedDataCiteObject.data.type; | ||
delete mappedDataCiteObject.data.attributes.prefix; | ||
|
||
// Extract DOI from the full URL | ||
const doi = record.datasetIdentifier.replace('https://doi.org/', ''); | ||
|
||
const dataObject = { | ||
doi, | ||
data: mappedDataCiteObject, | ||
dataciteAuthHash, | ||
} | ||
|
||
const response = await firebase.functions().httpsCallable("updateDraftDoi")(dataObject); | ||
return response.data.status; | ||
} | ||
|
||
export default performUpdateDraftDoi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters