(config: any, root: string, done: CallableFunction)
| 435 | } |
| 436 | |
| 437 | private static getShortLink(config: any, root: string, done: CallableFunction): void { |
| 438 | const useExternalShortener = options.urlShortenService !== 'default'; |
| 439 | const data = JSON.stringify({ |
| 440 | config: useExternalShortener ? serialiseState(config) : config, |
| 441 | }); |
| 442 | $.ajax({ |
| 443 | type: 'POST', |
| 444 | url: window.location.origin + root + 'api/shortener', |
| 445 | dataType: 'json', // Expected |
| 446 | contentType: 'application/json', // Sent |
| 447 | data: data, |
| 448 | success: (result: any) => { |
| 449 | const pushState = useExternalShortener ? null : result.url; |
| 450 | done(null, result.url, pushState, true); |
| 451 | }, |
| 452 | error: err => { |
| 453 | // Notify the user that we ran into trouble? |
| 454 | done(err.statusText, null, false); |
| 455 | }, |
| 456 | cache: true, |
| 457 | }); |
| 458 | } |
| 459 | |
| 460 | private static getEmbeddedHtml( |
| 461 | config: any, |
no test coverage detected