This repository was archived by the owner on Mar 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -8,19 +8,25 @@ import util from '../util/util'
88
99export default class AllEntriesComponent extends Component {
1010 state = {
11- allEntries : [ ]
11+ allEntries : [ ] ,
12+ displayURL : window . location . origin
1213 }
1314
1415 componentDidMount ( ) {
1516 this . getAllURLs ( )
17+ fetch ( "/displayurl" )
18+ . then ( response => response . json ( ) )
19+ . then ( data => this . setState ( { displayURL : data } ) ) ;
1620 }
1721
1822 getAllURLs = ( ) => {
1923 util . getAllURLs ( allEntries => {
2024 let parsed = [ ] ;
2125 for ( let key in allEntries ) {
22- allEntries [ key ] . ID = key ;
23- parsed . push ( allEntries [ key ] ) ;
26+ if ( { } . hasOwnProperty . call ( allEntries , key ) ) {
27+ allEntries [ key ] . ID = key ;
28+ parsed . push ( allEntries [ key ] ) ;
29+ }
2430 }
2531 this . setState ( { allEntries : parsed } )
2632 } )
@@ -47,7 +53,7 @@ export default class AllEntriesComponent extends Component {
4753 } , {
4854 Header : 'Short URL' ,
4955 accessor : "ID" ,
50- Cell : props => `${ window . location . origin } /${ props . value } `
56+ Cell : props => `${ this . state . displayURL } /${ props . value } `
5157 } , {
5258 Header : 'Visitor count' ,
5359 accessor : "Public.VisitCount"
You can’t perform that action at this time.
0 commit comments