本文整理匯總了TypeScript中@ionic-native/facebook.Facebook.logout方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Facebook.logout方法的具體用法?TypeScript Facebook.logout怎麽用?TypeScript Facebook.logout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ionic-native/facebook.Facebook
的用法示例。
在下文中一共展示了Facebook.logout方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: signOut
signOut() : firebase.Promise<any> {
if (this.angularFireAuth.auth.currentUser.providerData.length) {
for (var i = 0; i < this.angularFireAuth.auth.currentUser.providerData.length; i++) {
var provider = this.angularFireAuth.auth.currentUser.providerData[i];
if (provider.providerId == firebase.auth.GoogleAuthProvider.PROVIDER_ID) { // Se for o gooogle
// o disconnect limpa o oAuth token e tambem esquece qual conta foi selecionada para o login
return this.googlePlus.disconnect()
.then(() => {
return this.signOutFirebase();
});
} else if (provider.providerId == firebase.auth.FacebookAuthProvider.PROVIDER_ID) { // Se for facebook
return this.facebook.logout()
.then(() => {
return this.signOutFirebase();
})
} else if (provider.providerId == firebase.auth.TwitterAuthProvider.PROVIDER_ID) { // Se for twitter
return this.twitter.logout()
.then(() => {
return this.signOutFirebase();
})
}
}
}
return this.signOutFirebase();
}
示例2: resolve
this.http.post(this.storageProvider.serverAddress+"/logout",JSON.stringify({version:this.storageProvider.version}),{headers: headers}).map(res=>res.json()).subscribe((res)=>{
this.fb.logout().then((result)=>{
resolve(res);
},(err)=>{
resolve(res);
});
},(err)=>{
示例3: logout
logout(){
this.fb.logout().then((res) =>
console.log('Logged into Facebook!', res)).catch(e =>
console.log('Error logging into Facebook', e));
this.googleplus.logout().then((res) =>
console.log('logged out of google',res)).catch(err => console.error(err));
localStorage.clear();
this.navCtrl.setRoot(LoginPage);
}
示例4: Promise
return new Promise((resolve,reject)=>{
this.fb.logout().then((result)=>{
console.log("facebook logout success");
console.log("logout");
let headers = new Headers();
headers.append('Content-Type', 'application/json');
console.log("server: "+ this.storageProvider.serverAddress);
let body = JSON.stringify({version:this.storageProvider.version});
this.http.post(this.storageProvider.serverAddress+"/shop/logout",body,{headers: headers}).map(res=>res.json()).subscribe((res)=>{
resolve(res); // 'success'(move into home page) or 'invalidId'(move into signup page)
},(err)=>{
console.log("logout no response "+JSON.stringify(err));
reject("logout no response");
});
},(err)=>{
console.log("facebook logout failure");
reject("facebook logout failure");
});
});