gpt4 book ai didi

javascript - 注销后如何显示 toastr

转载 作者:行者123 更新时间:2023-12-01 15:38:11 26 4
gpt4 key购买 nike

从应用程序注销后,我必须显示 toastr 。这就是我正在尝试的。在这里,我在注销方法后调用 toastr 。

_this.logout().then({
success: function (result, request) {
Ext.toast({
html: 'Logged Out',
width: 270,
cls: 'smart-window alert-box',
bodyStyle: 'background:#90EE90;',
});
},
failure: function (result, request) {
console.log('failure!');
},
});

我有另一种方法,我在注销前调用 toastr ,但在注销后它会消失。注销后如何在 toastr 页面上重新定向时显示 toastr 。

这是我要重定向的注销

logout: function (options) {
let deferred = Ext.create("Deft.promise.Deferred");
Ext.Ajax.request({
url: '/logout',
method: 'GET',
success: function (result, request) {
var url = '/myUrl/logout';
var method = 'GET';
Ext.Ajax.request({
url: url,
method: method,
success: function (result, request) {
let extraParam = "someconfig";
let external_logout = "/someurl";

window.location.href = `${external_logout}${extraParam}`, 'width=1000 height=1000, scrollbars=yes, resizable=yes';

deferred.resolve(logout);
},
failure: function (result, request) {
deferred.reject();
}
});
},
failure: function (result, request) {
Ext.MessageBox.alert('Failed', 'Request failed');
deferred.reject();
}
});
return deferred.promise;
},

最佳答案

then 的 promise 对象假设只得到一个回调

_this.logout().then(() => {
Ext.toast({
html: 'Logged Out',
width: 270,
cls: 'smart-window alert-box',
bodyStyle: 'background:#90EE90;',
});
});

关于javascript - 注销后如何显示 toastr ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63645233/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com