是否可以从不属于 React 组件的 JavaScript 对象分派 Redux 函数?
通常当我希望发送一个动作时,我会执行以下操作:
我将把调度函数映射到组件的 props :
const mapDispatchToProps = dispatch => {
return {
autoCheckState: () => dispatch(actions.authCheckState()),
}
}
Run Code Online (Sandbox Code Playgroud)
然后我可以像这样调用调度函数:
async componentDidMount() {
await this.props.autoCheckState();
this.setState({
checking:false
})
}
Run Code Online (Sandbox Code Playgroud)
但是,现在我希望从我的 axiosinterceptor 对象中调用调度函数,并且它们没有“props”
这是我设想的使用它的方式,但它当然不起作用:
axiosInstance.interceptors.response.use(
response => {
return response
},error => {
######## bunch of code that is not relevant ##########
this.props.updateTokens(response.data.access,refreshToken) #<--- how i would call it if i based it off the first example
######## bunch of code that is not relevant …Run Code Online (Sandbox Code Playgroud) 我对 Regex 很陌生。现在我正在尝试使用正则表达式来准备我的标记字符串,然后再将其发送到数据库。
这是一个示例字符串:
@[admin](user:3) Testing this string @[hellotessginal](user:4) Hey!
Run Code Online (Sandbox Code Playgroud)
到目前为止,我能够@[admin](user:3)使用/@\[(.*?)]\((.*?):(\d+)\)/g
但是下一步是我希望删除(user:3)离开我的@[admin].
因此,通过剥离器函数的结果将是:
@[admin] Testing this string @[hellotessginal] Hey!
Run Code Online (Sandbox Code Playgroud)
请帮忙!
您好,我无法连接到 google smtp 服务器。上下文是,每当用户填写表单时,我的程序都会自动将反馈通过电子邮件发送到我的 gmail 帐户。除了程序卡在 send_mail 函数中之外,一切正常。
我试过这样做:
telnet smtp.gmail.com 25
Trying 2404:6800:4003:c03::6c...
Run Code Online (Sandbox Code Playgroud)
这最终会导致超时。
这是我的一些代码:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'xxxx@gmail.com'
EMAIL_HOST_PASSWORD = 'xxxxxx'
EMAIL_PORT = 465
EMAIL_USE_TLS = False
EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = DEFAULT_FROM_EMAIL
Run Code Online (Sandbox Code Playgroud)
根据 wagtail 的开箱即用(django cms 包)
我认为这可能与我的 UFW 阻止它有关,但是我尝试禁用 UFW 并重新启动 apache2。不幸的是,这无济于事。
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) …Run Code Online (Sandbox Code Playgroud) 我在这里有一个点击处理程序,它可以帮助我在点击列表中的项目时重定向页面。
onRowClick: (rowIndex) =>this.props.history.push( {pathname: '/tickets', param: rowIndex[0]};
Run Code Online (Sandbox Code Playgroud)
当然,代码将不起作用。rowIndex 是我希望传递到 url 的参数。
这是在我的控制台中记录的历史记录:
action: "POP"
block: ƒ block(prompt)
createHref: ƒ createHref(location)
go: ƒ go(n)
goBack: ƒ goBack()
goForward: ƒ goForward()
length: 50
listen: ƒ listen(listener)
location: {pathname: "/tickets", search: "", hash: "#/", state: undefined}
push: ƒ push(path, state)
replace: ƒ replace(path, state)
__proto__: Object
Run Code Online (Sandbox Code Playgroud)
这是我尝试过的:
onRowClick: (rowIndex) =>this.props.history.push({pathname: '/tickets' , id: rowIndex[0]})
Run Code Online (Sandbox Code Playgroud)
但是似乎对点击没有影响
根据我的理解,C 管道就像一种特殊的文件,在内部,内核跟踪表中每个进程的打开和关闭。请参阅此处的帖子
所以从这个意义上来说:
例如:进程1写入管道,进程2,3,4可以读取进程1写入的数据吗?