@@ -8,10 +8,10 @@ import SwaggerUI from 'swagger-ui'
8
8
import 'swagger-ui/dist/swagger-ui.css'
9
9
10
10
// semantic-ui
11
- import { Container , Header , Icon } from 'semantic-ui-react'
11
+ import { Segment , Button , Container , Header , Icon } from 'semantic-ui-react'
12
12
13
13
// services
14
- import { isRegistered } from 'services/self'
14
+ import { isRegistered , getCognitoUrl } from 'services/self'
15
15
import { updateUsagePlansAndApisList , getApi } from 'services/api-catalog'
16
16
17
17
// components
@@ -27,11 +27,11 @@ export default observer(class ApisPage extends React.Component {
27
27
containerRef = React . createRef ( )
28
28
hasRoot = false
29
29
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 }
33
33
34
- updateApi ( isInitial ) {
34
+ updateApi ( isInitial ) {
35
35
return getApi ( this . props . match . params . apiId || 'ANY' , true , this . props . match . params . stage , isInitial )
36
36
. then ( api => {
37
37
if ( this . containerRef == null ) return
@@ -72,10 +72,26 @@ export default observer(class ApisPage extends React.Component {
72
72
} )
73
73
}
74
74
75
- render ( ) {
75
+ signIn ( ) {
76
+ window . location = getCognitoUrl ( 'login' ) ;
77
+ }
78
+
79
+ render ( ) {
76
80
let errorHeader
77
81
let errorBody
78
82
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
+
79
95
if ( store . apiList . loaded ) {
80
96
if ( ! store . apiList . apiGateway . length && ! store . apiList . generic . length ) {
81
97
errorHeader = 'No APIs Published'
0 commit comments