@@ -22,17 +22,6 @@ import * as queryString from 'query-string'
2222
2323const store = createStore ( )
2424
25- function getParameterByName ( name : string ) : string | null {
26- const url = window . location . href
27- name = name . replace ( / [ \[ \] ] / g, '\\$&' )
28- const regexa = new RegExp ( '[?&]' + name + '(=([^&#]*)|&|#|$)' )
29- const results = regexa . exec ( url )
30- if ( ! results || ! results [ 2 ] ) {
31- return null
32- }
33- return decodeURIComponent ( results [ 2 ] . replace ( / \+ / g, ' ' ) )
34- }
35-
3625export interface Props {
3726 endpoint ?: string
3827 endpointUrl ?: string
@@ -47,7 +36,6 @@ export interface Props {
4736 onSaveConfig ?: ( configString : string ) => void
4837 onNewWorkspace ?: ( ) => void
4938 getRef ?: ( ref : any ) => void
50- platformToken ?: string
5139 session ?: any
5240 env ?: any
5341 config ?: GraphQLConfig
@@ -59,7 +47,6 @@ export interface State {
5947 subscriptionPrefix ?: string
6048 subscriptionEndpoint ?: string
6149 shareUrl ?: string
62- platformToken ?: string
6350 settingsString : string
6451 settings : ISettings
6552 configIsYaml ?: boolean
@@ -95,7 +82,10 @@ export default class MiddlewareApp extends React.Component<Props, State> {
9582
9683 let headers
9784 let endpoint =
98- props . endpoint || props . endpointUrl || params . endpoint || location . href
85+ props . endpoint ||
86+ props . endpointUrl ||
87+ params . endpoint ||
88+ `${ location . origin } ${ location . pathname } `
9989
10090 let subscriptionEndpoint : any =
10191 props . subscriptionEndpoint || params . subscriptionEndpointndpoint
@@ -123,10 +113,6 @@ export default class MiddlewareApp extends React.Component<Props, State> {
123113
124114 this . state = {
125115 endpoint : this . absolutizeUrl ( endpoint ) ,
126- platformToken :
127- props . platformToken ||
128- localStorage . getItem ( 'platform-token' ) ||
129- undefined ,
130116 subscriptionEndpoint,
131117 settingsString,
132118 settings : this . props . settings || this . getSettings ( settingsString ) ,
@@ -237,14 +223,6 @@ export default class MiddlewareApp extends React.Component<Props, State> {
237223 return endpoint . replace ( / ^ h t t p / , 'ws' )
238224 }
239225
240- componentWillMount ( ) {
241- const platformToken = getParameterByName ( 'platform-token' )
242- if ( platformToken && platformToken . length > 0 ) {
243- localStorage . setItem ( 'platform-token' , platformToken )
244- window . location . replace ( window . location . origin + window . location . pathname )
245- }
246- }
247-
248226 componentDidMount ( ) {
249227 if ( this . state . subscriptionEndpoint === '' ) {
250228 this . updateSubscriptionsUrl ( )
@@ -291,7 +269,6 @@ export default class MiddlewareApp extends React.Component<Props, State> {
291269 onChangeSubscriptionsEndpoint = {
292270 this . handleChangeSubscriptionsEndpoint
293271 }
294- adminAuthToken = { this . state . platformToken }
295272 settings = { this . normalizeSettings ( this . state . settings ) }
296273 settingsString = { this . state . settingsString }
297274 onSaveSettings = { this . handleSaveSettings }
@@ -449,10 +426,7 @@ export default class MiddlewareApp extends React.Component<Props, State> {
449426 }
450427
451428 private getTitle ( ) {
452- if (
453- this . state . platformToken ||
454- this . state . endpoint . includes ( 'api.graph.cool' )
455- ) {
429+ if ( this . state . endpoint . includes ( 'api.graph.cool' ) ) {
456430 const projectId = this . getProjectId ( this . state . endpoint )
457431 const cluster = this . state . endpoint . includes ( 'api.graph.cool' )
458432 ? 'shared'
0 commit comments