File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22const app = ( ) => ( {
33 data ( ) {
44 return {
5+ token : new URLSearchParams ( window . location . search ) . get ( 'token' ) || '' ,
56 query : {
67 type : 'ping' ,
78 locations : [ ] ,
@@ -37,6 +38,11 @@ const app = () => ({
3738 clearInterval ( this . resultInterval ) ;
3839 }
3940 } ,
41+ token ( newToken ) {
42+ const url = new URL ( window . location ) ;
43+ newToken ? url . searchParams . set ( 'token' , newToken ) : url . searchParams . delete ( 'token' ) ;
44+ window . history . replaceState ( { } , '' , url ) ;
45+ } ,
4046 } ,
4147 computed : {
4248 responseParams ( ) {
@@ -273,6 +279,7 @@ const app = () => ({
273279 body : JSON . stringify ( body ) ,
274280 headers : {
275281 'content-type' : 'application/json' ,
282+ ...( this . token ? { Authorization : `Bearer ${ this . token } ` } : { } ) ,
276283 } ,
277284 } ) ;
278285
@@ -315,6 +322,12 @@ const app = () => ({
315322 </div>
316323 <div class="row border border-primary">
317324 <form @submit="submitPostMeasurement" class="col">
325+ <div class="form-group row">
326+ <label for="token" class="col-sm-2 col-form-label">token</label>
327+ <div class="col-sm-10">
328+ <input v-model="token" name="token" id="token" placeholder="GP API token" />
329+ </div>
330+ </div>
318331 <div class="form-group row">
319332 <label for="query_type" class="col-sm-2 col-form-label">type</label>
320333 <div class="col-sm-10">
You can’t perform that action at this time.
0 commit comments