Skip to content

Commit abaec7f

Browse files
authored
Merge pull request #99 from back4app/fix-learn-more-link
Change learn more link
2 parents 7960ff3 + 19cd018 commit abaec7f

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/components/B4ACodeTree/B4ACodeTree.react.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ import B4ATreeActions from 'components/B4ACodeTree/B4ATreeActions';
99
import 'jstree/dist/themes/default/style.css'
1010
import 'components/B4ACodeTree/B4AJsTree.css'
1111

12-
const cloudFolderPlaceholder = "// The first deployed file must be named main.js and must be placed on the root of the cloud folder.\n" +
12+
const getCloudFolderPlaceholder = (appId, restKey) => "// The first deployed file must be named main.js and must be placed on the root of the cloud folder.\n" +
1313
"// The example below shows you how a cloud code function looks like.\n\n" +
1414
"/*\n* Parse.Cloud.define(\"hello\", function(request, response){\n" +
1515
"* \tresponse.success(\"Hello world!\");\n" +
16-
"* });\n*/\n" +
16+
"* });\n*/\n\n" +
17+
"// To see it working, you only need to call it through SDK or REST API.\n" +
18+
"// Here is how you have to call it via REST API:\n" +
19+
"\n/*\n* curl -X POST \\\n" +
20+
`* -H \"X-Parse-Application-Id: ${appId}\" \\\n` +
21+
`* -H \"X-Parse-REST-API-Key: ${restKey}\" \\\n` +
22+
"* -H \"Content-Type: application/json\" \\\n" +
23+
"* -d \"{}\" \\\n" +
24+
`* ${b4aSettings.PARSE_API_URL}/functions/hello\n*/\n` +
1725
"\n// If you have set a function in another cloud code file, called \"test.js\" (for example)\n" +
1826
"// you need to refer it in your main.js, as you can see below:\n" +
1927
"\n/* require(\"./test.js\"); */"
@@ -22,10 +30,19 @@ const publicFolderPlaceholder = "// Public folder can be used to deploy public s
2230
"\n" +
2331
"// You have to setup a custom domain or subdomain at Back4App to access the public static content"
2432

33+
let cloudFolderPlaceholder
34+
2535
export default class B4ACodeTree extends React.Component {
2636
constructor(props){
2737
super(props);
2838

39+
// get appId and restKey from props
40+
this.appId = this.props.currentApp && this.props.currentApp.applicationId || '<YOUR_APP_ID_HERE>'
41+
this.restKey = this.props.currentApp && this.props.currentApp.restKey || '<YOUR_REST_KEY_HERE>'
42+
43+
// set a cloudCodePlaceholder with the app's data
44+
cloudFolderPlaceholder = getCloudFolderPlaceholder(this.appId, this.restKey)
45+
2946
this.state = {
3047
selectedFile: '',
3148
extension: '',

src/dashboard/Data/CloudCode/B4ACloudCode.react.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class B4ACloudCode extends CloudCode {
217217
<Button
218218
value='LEARN MORE'
219219
primary={true}
220-
onClick={() => window.open('https://docs.parseplatform.org/cloudcode/guide/', '_blank')} />
220+
onClick={() => window.open('https://back4app.com/docs/platform/get-started/cloud-functions', '_blank')} />
221221
</div>
222222

223223
alertWhatIs = <B4AAlert
@@ -232,7 +232,11 @@ class B4ACloudCode extends CloudCode {
232232
title="Back4App Tips"
233233
description={alertTipsMessage} />
234234

235-
content = <B4ACodeTree files={this.state.files} parentState={this.setState.bind(this)} />
235+
content = <B4ACodeTree
236+
files={this.state.files}
237+
parentState={this.setState.bind(this)}
238+
currentApp={this.context.currentApp}
239+
/>
236240

237241
footer = <div className={`${styles.row} ${styles.footer}`}>
238242
<Button

0 commit comments

Comments
 (0)