File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -2,20 +2,27 @@ import { AxiosInstance } from './types';
2
2
3
3
export async function getData ( instance : AxiosInstance , url : string , data ?: any ) {
4
4
try {
5
- console . log ( instance . defaults . baseURL , instance . stackConfig . live_preview . host ) ;
6
5
if ( instance . stackConfig && instance . stackConfig . live_preview ) {
7
6
const livePreviewParams = instance . stackConfig . live_preview ;
8
7
9
8
if ( livePreviewParams . enable ) {
10
9
data . live_preview = livePreviewParams . live_preview || 'init' ;
11
10
}
12
11
12
+ if ( livePreviewParams . preview_token ) {
13
+ instance . defaults . headers . preview_token = livePreviewParams . preview_token ;
14
+ instance . defaults . headers . live_preview = livePreviewParams . live_preview ;
15
+ }
16
+
13
17
if ( livePreviewParams . enable && livePreviewParams . live_preview && livePreviewParams . live_preview !== 'init' ) {
14
- instance . defaults . baseURL = livePreviewParams . host ;
18
+ if ( livePreviewParams . host . split ( 0 , 8 ) == 'https://' ) {
19
+ instance . defaults . baseURL = livePreviewParams . host ;
20
+ } else {
21
+ instance . defaults . baseURL = 'https://' + livePreviewParams . host ;
22
+ }
15
23
}
16
24
}
17
25
const response = await instance . get ( url , { params : data } ) ;
18
- console . log ( '🚀 ~ getData ~ url, { params: data }:' , url , { params : data } ) ;
19
26
20
27
if ( response && response . data ) {
21
28
return response . data ;
You can’t perform that action at this time.
0 commit comments