-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #209 from stellar/release/3.1.0
Release `3.1.0` to `main`
- Loading branch information
Showing
16 changed files
with
629 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { handleApiResponse } from "api/handleApiResponse"; | ||
import { API_URL } from "constants/envVariables"; | ||
import { getSdpTenantName } from "helpers/getSdpTenantName"; | ||
import { ApiDisbursement } from "types"; | ||
|
||
export const deleteDisbursementDraft = async ( | ||
token: string, | ||
draftId: string, | ||
): Promise<ApiDisbursement> => { | ||
const response = await fetch(`${API_URL}/disbursements/${draftId}`, { | ||
method: "DELETE", | ||
headers: { | ||
"Content-Type": "application/json", | ||
Authorization: `Bearer ${token}`, | ||
"SDP-Tenant-Name": getSdpTenantName(), | ||
}, | ||
}); | ||
|
||
return handleApiResponse(response); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { API_URL } from "constants/envVariables"; | ||
import { getSdpTenantName } from "helpers/getSdpTenantName"; | ||
import { handleSearchParams } from "api/handleSearchParams"; | ||
import { Export } from "types"; | ||
|
||
export const getExport = async <T>( | ||
token: string, | ||
type: Export, | ||
searchParams?: T, | ||
): Promise<void> => { | ||
const params = handleSearchParams(searchParams); | ||
|
||
const response = await fetch(`${API_URL}/exports/${type}${params}`, { | ||
method: "GET", | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
"SDP-Tenant-Name": getSdpTenantName(), | ||
}, | ||
}); | ||
|
||
if (!response.ok) { | ||
throw new Error(`HTTP error! status: ${response.status}`); | ||
} | ||
|
||
const contentDisposition = response.headers.get("content-disposition"); | ||
const filename = contentDisposition | ||
? contentDisposition.split("filename=")[1] | ||
: `${type}_${new Date().toISOString().split("T")[0]}.csv`; | ||
|
||
// Create a download from the response | ||
const blob = await response.blob(); | ||
const url = window.URL.createObjectURL(blob); | ||
const link = document.createElement("a"); | ||
link.href = url; | ||
link.setAttribute("download", filename); | ||
document.body.appendChild(link); | ||
link.click(); | ||
link.remove(); | ||
window.URL.revokeObjectURL(url); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.