11import parseLinkHeader from 'parse-link-header' ;
2+ import * as misc from '../misc' ;
23
34export const setRecentSnippets = snippets => ( {
45 type : 'SET_RECENT_SNIPPETS' ,
@@ -14,7 +15,7 @@ export const fetchRecentSnippets = marker => (dispatch) => {
1415 let qs = '' ;
1516 if ( marker ) { qs = `&marker=${ marker } ` ; }
1617
17- return fetch ( `//api.xsnippet.org/ snippets?limit=20${ qs } `)
18+ return fetch ( misc . getApiUri ( `/ snippets?limit=20${ qs } `) )
1819 . then ( ( response ) => {
1920 const links = parseLinkHeader ( response . headers . get ( 'Link' ) ) ;
2021
@@ -30,7 +31,7 @@ export const setSnippet = snippet => ({
3031} ) ;
3132
3233export const fetchSnippet = id => dispatch => (
33- fetch ( `//api.xsnippet.org/ snippets/${ id } `)
34+ fetch ( misc . getApiUri ( `/ snippets/${ id } `) )
3435 . then ( response => response . json ( ) )
3536 . then ( json => dispatch ( setSnippet ( json ) ) )
3637) ;
@@ -41,13 +42,13 @@ export const setSyntaxes = syntaxes => ({
4142} ) ;
4243
4344export const fetchSyntaxes = dispatch => (
44- fetch ( '//api.xsnippet.org/ syntaxes')
45+ fetch ( misc . getApiUri ( '/ syntaxes') )
4546 . then ( response => response . json ( ) )
4647 . then ( json => dispatch ( setSyntaxes ( json ) ) )
4748) ;
4849
4950export const postSnippet = ( snippet , onSuccess ) => dispatch => (
50- fetch ( '//api.xsnippet.org/ snippets', {
51+ fetch ( misc . getApiUri ( '/ snippets') , {
5152 method : 'POST' ,
5253 headers : {
5354 'Accept' : 'application/json' ,
0 commit comments