forked from acouzens/open5gs
auth module is done
This commit is contained in:
parent
0639fa2071
commit
e2b789cafe
|
@ -0,0 +1,12 @@
|
|||
import React from 'react'
|
||||
import Session from './session'
|
||||
|
||||
export default class extends React.Component {
|
||||
|
||||
// Expose session to all pages
|
||||
static async getInitialProps({req}) {
|
||||
const session = new Session({req})
|
||||
return {session: await session.getSession(true)}
|
||||
}
|
||||
|
||||
}
|
|
@ -3,11 +3,11 @@
|
|||
*/
|
||||
import Link from 'next/link'
|
||||
import React from 'react'
|
||||
import Page from '../components/page'
|
||||
import Start from '../components/start'
|
||||
import Layout from '../components/layout'
|
||||
import Session from '../components/session'
|
||||
|
||||
export default class extends Page {
|
||||
|
||||
export default class extends Start {
|
||||
render() {
|
||||
return (
|
||||
<Layout session={this.props.session}>
|
||||
|
|
|
@ -59,8 +59,7 @@ export default class extends Page {
|
|||
const session = new Session()
|
||||
session.signin(this.state.username, this.state.password)
|
||||
.then(() => {
|
||||
// @FIXME next/router not working reliably so using window.location
|
||||
window.location = '/'
|
||||
this.props.url.push('/')
|
||||
})
|
||||
.catch(err => {
|
||||
// @FIXME Handle error
|
||||
|
|
Loading…
Reference in New Issue