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'
8
8
9
9
export default class AllEntriesComponent extends Component {
10
10
state = {
11
- allEntries : [ ]
11
+ allEntries : [ ] ,
12
+ displayURL : window . location . origin
12
13
}
13
14
14
15
componentDidMount ( ) {
15
16
this . getAllURLs ( )
17
+ fetch ( "/displayurl" )
18
+ . then ( response => response . json ( ) )
19
+ . then ( data => this . setState ( { displayURL : data } ) ) ;
16
20
}
17
21
18
22
getAllURLs = ( ) => {
19
23
util . getAllURLs ( allEntries => {
20
24
let parsed = [ ] ;
21
25
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
+ }
24
30
}
25
31
this . setState ( { allEntries : parsed } )
26
32
} )
@@ -47,7 +53,7 @@ export default class AllEntriesComponent extends Component {
47
53
} , {
48
54
Header : 'Short URL' ,
49
55
accessor : "ID" ,
50
- Cell : props => `${ window . location . origin } /${ props . value } `
56
+ Cell : props => `${ this . state . displayURL } /${ props . value } `
51
57
} , {
52
58
Header : 'Visitor count' ,
53
59
accessor : "Public.VisitCount"
You can’t perform that action at this time.
0 commit comments