API so that you don't have to use a global variable for pretender

This commit is contained in:
Robin Ward
2017-09-13 11:54:49 -04:00
parent a6fc42753c
commit 4f9ba874a9
3 changed files with 49 additions and 35 deletions

View File

@ -20,7 +20,7 @@ export function parsePostData(query) {
return result;
};
function response(code, obj) {
export function response(code, obj) {
if (typeof code === "object") {
obj = code;
code = 200;
@ -28,7 +28,10 @@ function response(code, obj) {
return [code, {"Content-Type": "application/json"}, obj];
}
const success = () => response({ success: true });
export function success() {
return response({ success: true });
}
const loggedIn = () => !!Discourse.User.current();