1- import { ComponentState } from ". /state/component" ;
2- import { ContribPoint , Contributions } from ". /model/extension" ;
3- import { CallbackRequest , StateChangeRequest } from ". /model/callback" ;
4- import { callApi } from ". /utils/fetchApiResult" ;
1+ import { ComponentState } from "@ /state/component" ;
2+ import { ContribPoint , Contributions } from "@ /model/extension" ;
3+ import { CallbackRequest , StateChangeRequest } from "@ /model/callback" ;
4+ import { callApi } from "@ /utils/fetchApiResult" ;
55
66const defaultServerUrl = "http://localhost:8888" ;
77const defaultEndpointName = "dashi" ;
@@ -11,15 +11,17 @@ export interface ApiOptions {
1111 endpointName ?: string ;
1212}
1313
14- export async function fetchContributions ( options ?: ApiOptions ) : Promise < Contributions > {
14+ export async function fetchContributions (
15+ options ?: ApiOptions ,
16+ ) : Promise < Contributions > {
1517 return callApi ( makeUrl ( "contributions" , options ) ) ;
1618}
1719
1820export async function fetchInitialComponentState (
1921 contribPoint : ContribPoint ,
2022 contribIndex : number ,
2123 inputValues : unknown [ ] ,
22- options ?: ApiOptions
24+ options ?: ApiOptions ,
2325) : Promise < ComponentState > {
2426 return callApi ( makeUrl ( `layout/${ contribPoint } /${ contribIndex } ` , options ) , {
2527 body : JSON . stringify ( { inputValues } ) ,
@@ -29,7 +31,7 @@ export async function fetchInitialComponentState(
2931
3032export async function fetchStateChangeRequests (
3133 callbackRequests : CallbackRequest [ ] ,
32- options ?: ApiOptions
34+ options ?: ApiOptions ,
3335) : Promise < StateChangeRequest [ ] > {
3436 return callApi ( makeUrl ( "callback" , options ) , {
3537 body : JSON . stringify ( { callbackRequests : callbackRequests } ) ,
@@ -40,5 +42,5 @@ export async function fetchStateChangeRequests(
4042function makeUrl ( path : string , options ?: ApiOptions ) : string {
4143 const serverUrl = options ?. serverUrl || defaultServerUrl ;
4244 const endpointName = options ?. endpointName || defaultEndpointName ;
43- return `${ serverUrl } /${ endpointName } /${ path } `
45+ return `${ serverUrl } /${ endpointName } /${ path } ` ;
4446}
0 commit comments