@@ -8,10 +8,10 @@ import SwaggerUI from 'swagger-ui'
88import 'swagger-ui/dist/swagger-ui.css'
99
1010// semantic-ui
11- import { Container , Header , Icon } from 'semantic-ui-react'
11+ import { Segment , Button , Container , Header , Icon } from 'semantic-ui-react'
1212
1313// services
14- import { isRegistered } from 'services/self'
14+ import { isRegistered , getCognitoUrl } from 'services/self'
1515import { updateUsagePlansAndApisList , getApi } from 'services/api-catalog'
1616
1717// components
@@ -27,11 +27,11 @@ export default observer(class ApisPage extends React.Component {
2727 containerRef = React . createRef ( )
2828 hasRoot = false
2929
30- componentDidMount ( ) { this . updateApi ( true ) }
31- componentDidUpdate ( ) { this . updateApi ( false ) }
32- componentWillUnmount ( ) { this . containerRef = null }
30+ componentDidMount ( ) { this . updateApi ( true ) }
31+ componentDidUpdate ( ) { this . updateApi ( false ) }
32+ componentWillUnmount ( ) { this . containerRef = null }
3333
34- updateApi ( isInitial ) {
34+ updateApi ( isInitial ) {
3535 return getApi ( this . props . match . params . apiId || 'ANY' , true , this . props . match . params . stage , isInitial )
3636 . then ( api => {
3737 if ( this . containerRef == null ) return
@@ -72,10 +72,26 @@ export default observer(class ApisPage extends React.Component {
7272 } )
7373 }
7474
75- render ( ) {
75+ signIn ( ) {
76+ window . location = getCognitoUrl ( 'login' ) ;
77+ }
78+
79+ render ( ) {
7680 let errorHeader
7781 let errorBody
7882
83+ if ( ! store . apiKey ) {
84+ return (
85+ < Segment placeholder style = { { margin : '5em' } } >
86+ < Header icon >
87+ < Icon name = 'sign-in' />
88+ Please sign-in to access the available APIs
89+ </ Header >
90+ < Button positive onClick = { this . signIn } > Sign In</ Button >
91+ </ Segment >
92+ )
93+ }
94+
7995 if ( store . apiList . loaded ) {
8096 if ( ! store . apiList . apiGateway . length && ! store . apiList . generic . length ) {
8197 errorHeader = 'No APIs Published'
0 commit comments