Parse.User.current()、全局变量等 [英] Parse.User.current(), globals etc

查看:53
本文介绍了Parse.User.current()、全局变量等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Express 和 Parse 的新手.我正在尝试对 Anyimg 云教程进行简单的修改.我只想在用户通过身份验证时显示默认主页.如果我使用 Parse.User.authenticated(),我会得到:

I am new to Express and Parse. I am trying to make a simple modification to the Anyimg cloud tutorial. I would like to display the default home page only if the user is authenticated. If I use Parse.User.authenticated(), I get:

错误是 TypeError: Object function (){e.apply(this,arguments)} has no method 'authenticated'在 app.js:33:18在 main.js:1:1

The error was TypeError: Object function (){e.apply(this,arguments)} has no method 'authenticated' at app.js:33:18 at main.js:1:1

Parse.User.current() 编译没有错误,但代码不起作用.我错过了什么?在过去的 3 天里,我尝试了 60 多种不同的选择,但都没有成功.

Parse.User.current() compiles with no error, but the code does not work. What am I missing? I have tried literally over 60 different options over the last 3 days with no success.

我还尝试在 user.js 中声明一个 GLOBAL,但没有奏效.我在 app.js 中做了一个 require 云/用户,但根本没有帮助.

I also tried to declare a GLOBAL from within user.js and that did not work. I did a require cloud/user from within app.js and that did not help at all.

希望有人能帮忙.大约一年前的 Parse 教程(在 parse.com 之外)似乎已经失效.

I hope someone can help. It appears that Parse tutorials (outside parse.com) from about a year ago break.

另一方面,我想在注销时显示登录页面(非默认).我在不到 10 分钟的时间内完成了.

On the other hand, I wanted to display the login page (not default) upon logout. I got it done in less than 10 minutes.

推荐答案

如上所述,我已经有了与 Fosco 类似的代码.但是,var 语句不在函数的范围内,因为我正在尝试 o.我刚搬进去,一切正常.感谢大家对此进行调查.

As mentioned above, I already had code that was similar to Fosco's. However, the var statement was not in the scope of the function as I was trying out o. I just moved it in and it all works. Thanks to everyone for looking into this.

这篇关于Parse.User.current()、全局变量等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆