add server-sent errors and reduce oauth flow bare error pages

This commit is contained in:
41666 2019-03-21 07:04:17 -05:00
parent deef06fa2a
commit cd70c58cc9
5 changed files with 26 additions and 9 deletions

View file

@ -61,8 +61,10 @@ export default class CustomErrorPage extends React.Component {
return { statusCode }
}
render400 = () => this.out('400', `Your client sent me something weird...`, '((((;゜Д゜)))')
render403 = () => this.out('403', `You weren't allowed to access this.`, 'あなたはこの点に合格しないかもしれません')
render404 = () => this.out('404', 'This page is in another castle.', 'お探しのページは見つかりませんでした')
render419 = () => this.out('419', 'Something went too slowly...', 'おやすみなさい〜')
render500 = () => this.out('500', `The server doesn't like you right now. Feed it a cookie.`, 'クッキーを送ってください〜 クッキーを送ってください〜')
renderDefault = () => this.out('Oops', 'Something went bad. How could this happen?', 'おねがい?')
renderServer = () => this.out('Oops.', 'Server was unhappy about this render. Try reloading or changing page.', 'クッキーを送ってください〜')
@ -86,16 +88,18 @@ export default class CustomErrorPage extends React.Component {
}
handlers = {
400: this.render400,
403: this.render403,
404: this.render404,
419: this.render419,
500: this.render500,
1001: this.renderAuthExpired
}
render () {
if (this.props.originalName === 'ErrorPage') {
return this.renderServer()
}
// if (this.props.originalName === 'ErrorPage') {
// return this.renderServer()
// }
if (this.props.statusCode in this.handlers) {
return this.handlers[this.props.statusCode]()

View file

@ -163,7 +163,6 @@ export default class AuthLogin extends React.Component<AuthLoginProps, AuthLogin
}
get dm () {
console.log({ e: process.env })
if (BOT_HANDLE) {
const [username, discrim] = BOT_HANDLE.split('#')
return <><b>{ username }</b>#{discrim}</>