Skip to content

Commit

Permalink
allow for relative photo and details urls
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Mar 3, 2018
1 parent e559e35 commit b4437da
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tutorcruncher-socket",
"version": "1.3.2",
"version": "1.3.3",
"description": "TutorCruncher socket",
"author": "Samuel Colvin <[email protected]>",
"private": false,
Expand Down
6 changes: 5 additions & 1 deletion src/components/contractors/ConModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ class ConModal extends Component {
)
}
const {contractor, contractor_extra} = _con
let photo_src = contractor.photo
if (photo_src.startsWith('/')) {
photo_src = this.props.config.api_root + photo_src
}
return (
<Modal history={this.props.history} title={contractor.name} last_url={this.props.last_url}>
<div className="tcs-body">
<div className="tcs-extra">
<img src={contractor.photo} alt={contractor.name}/>
<img src={photo_src} alt={contractor.name}/>

<Stars contractor={contractor} root={this.props.root}/>

Expand Down
4 changes: 3 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ export function get_company_options (public_key, config) {

function request (app, path, send_data, method, expected_statuses) {
let url = path
if (!url.startsWith('http')) {
if (url.startsWith('/')) {
url = app.props.config.api_root + url
} else if (!url.startsWith('http')) {
url = `${app.props.config.api_root}/${app.props.public_key}/${path}`
}

Expand Down

0 comments on commit b4437da

Please sign in to comment.