Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat:added title to response
  • Loading branch information
sharon-kathambi committed Oct 11, 2023
commit b5379ccc6feda738d169249614df549505fd067c
9 changes: 7 additions & 2 deletions components/Books.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ class Books extends React.Component {
});

let url = "";
let Identifier = this.state.IAIdentifier;
console.log(Identifier);
const isAlphanumericLess50 = /^(?=.*[a-zA-Z])(?=.*[0-9])[a-zA-Z0-9]{1,50}$/;
switch (this.state.option) {
case "gb":
Expand All @@ -233,7 +235,8 @@ class Books extends React.Component {
} else if (!isAlphanumericLess50.test(response.IAIdentifier)) {
this.setState({
isValidIdentifier: false,
IATitle: response.IAIdentifier,
//IATitle: response.IAIdentifier,
IATitle: response.titleInIA,
inputDisabled: true,
});
console.log(response.IAIdentifier);
Expand Down Expand Up @@ -316,6 +319,8 @@ class Books extends React.Component {
}&categoryID=${categoryID}&userName=${userName}&IAtitle=${
this.state.IAIdentifier
}`;

console.log(url);
fetch(url)
.then((res) => res.json())
.then((response) => {
Expand All @@ -334,7 +339,7 @@ class Books extends React.Component {
this.setState({
isValidIdentifier: false,
//IATitle: response.IAIdentifier,
IATitle: response.IATitle,
IATitle: response.titleInIA,
inputDisabled: true,
});
} else {
Expand Down
1 change: 1 addition & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ app
} else {
res.send({
error: false,
IAIdentifier: titleInIA,
message: "You will be mailed with the details soon!",
});
PDLProducer(bookid, titleInIA, categoryID, email, authUserName);
Expand Down