Skip to content

Commit 19f5ce6

Browse files
AndrewLaneflovilmart
authored andcommitted
Add a link that opens up a javascript prompt to allow you to use a different app id than myAppId if you want (#282)
1 parent e414422 commit 19f5ce6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

public/assets/js/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ XHR.setCallback = function(callback, failureCallback) {
151151
XHR.POST = function(path, callback) {
152152
var seed = {"score":1337,"playerName":"Sean Plott","cheatMode":false}
153153
this.xhttp.open("POST", Config.getUrl() + path, true);
154-
this.xhttp.setRequestHeader("X-Parse-Application-Id", "myAppId");
154+
this.xhttp.setRequestHeader("X-Parse-Application-Id", $('#appId').val());
155155
this.xhttp.setRequestHeader("Content-type", "application/json");
156156
this.xhttp.send(JSON.stringify(seed));
157157
}
158158

159159
XHR.GET = function(path, callback) {
160160
this.xhttp.open("GET", Config.getUrl() + path + '/' + Store.objectId, true);
161-
this.xhttp.setRequestHeader("X-Parse-Application-Id", "myAppId");
161+
this.xhttp.setRequestHeader("X-Parse-Application-Id", $('#appId').val());
162162
this.xhttp.setRequestHeader("Content-type", "application/json");
163163
this.xhttp.send(null);
164164
}

public/test.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
<p class="up-and-running">Looks like our local Parse Serve is running under <span id="parse-url">...</span>. Let’s test it?
</p>
2121

22+
<p>We'll use an app id of "myAppId" to connect to Parse Server. Or, you can
23+
<a href="javascript: var newAppId = prompt('What app id should we use to talk to Parse Server?'); if (newAppId) { $('#appId').val(newAppId); }">change it</a>.
24+
2225
<p>We have an express server with Parse server running on top of it connected to a MongoDB.</p>
2326

2427
<p>The following steps will try to save some data on parse server and then fetch it back. Hey ho?</p>
@@ -100,5 +103,6 @@
100103
</div>
101104
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
102105
<script src="/public/assets/js/script.js"></script>
106+
<input type="hidden" id="appId" value="myAppId" />
103107
</body>
104108
</html>

0 commit comments

Comments
 (0)