chore: revamp the API tokens workflow (#2880)
* chore: added getLayout method to api tokens pages * revamp: api tokens workflow * chore: add title validation and update types * chore: minor UI updates * chore: update route
This commit is contained in:
parent
7b5eea8722
commit
7ad0360920
25 changed files with 711 additions and 747 deletions
|
|
@ -1,17 +1,14 @@
|
|||
export const csvDownload = (data: Array<Array<string>> | { [key: string]: string }, name: string) => {
|
||||
let rows = [];
|
||||
const rows = Array.isArray(data) ? [...data] : [Object.keys(data), Object.values(data)];
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
rows = [...data];
|
||||
} else {
|
||||
rows = [Object.keys(data), Object.values(data)];
|
||||
}
|
||||
const csvContent = "data:text/csv;charset=utf-8," + rows.map((e) => e.join(",")).join("\n");
|
||||
const encodedUri = encodeURI(csvContent);
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = encodedUri;
|
||||
link.download = `${name}.csv`;
|
||||
|
||||
let csvContent = "data:text/csv;charset=utf-8," + rows.map((e) => e.join(",")).join("\n");
|
||||
var encodedUri = encodeURI(csvContent);
|
||||
var link = document.createElement("a");
|
||||
link.setAttribute("href", encodedUri);
|
||||
link.setAttribute("download", `${name}.csv`);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link); // Cleanup after the download link is clicked
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue