(side: string, path: string, normalizeJSON: boolean)
| 70 | |
| 71 | // Either side can be empty (i.e. an add or a delete), in which case getOrNull resolves to null. |
| 72 | async function getOrNull(side: string, path: string, normalizeJSON: boolean) { |
| 73 | if (!path) return null; |
| 74 | const data = new URLSearchParams(); |
| 75 | data.set('path', path); |
| 76 | if (normalizeJSON) { |
| 77 | data.set('normalize_json', '1'); |
| 78 | } |
| 79 | const response = await fetch(`/${side}/get_contents`, { |
| 80 | method: 'post', |
| 81 | body: data, |
| 82 | }); |
| 83 | return response.text(); |
| 84 | } |
| 85 | |
| 86 | export interface CodeDiffContainerProps { |
| 87 | filePair: FilePair; |
no test coverage detected