Skip to content

Commit

Permalink
csv importers - examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mluena committed Aug 29, 2024
1 parent c51199a commit bad888f
Show file tree
Hide file tree
Showing 9 changed files with 3,234 additions and 3,026 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ import { uploadProjectsCsv, uploadProjectsSuggestionCsv } from "@/services/proje
import CSVInfoContent from "./csv-info-content";

import type { CSVImportTypes } from "./types";
import { uploadCollaboratorsCsv } from "@/services/collaborators";
import { uploadOtherToolsCsv, uploadOtherToolsSuggestionCsv } from "@/services/other-tools";
import {
uploadCollaboratorsCsv,
uploadCollaboratorEditSuggestionsCsv,
} from "@/services/collaborators";
import { uploadOtherToolsCsv, uploadToolEditSuggestionCsv } from "@/services/other-tools";

export default function CSVImport({
valueType,
Expand Down Expand Up @@ -85,7 +88,7 @@ export default function CSVImport({
push("/collaborators");
});
ME_DATA?.role?.type === "authenticated" &&
uploadProjectsSuggestionCsv(files, {
uploadCollaboratorEditSuggestionsCsv(files, {
Authorization: `Bearer ${apiToken}`,
}).then(() => {
push("/dashboard");
Expand All @@ -99,7 +102,7 @@ export default function CSVImport({
push("/other-tools");
});
ME_DATA?.role?.type === "authenticated" &&
uploadOtherToolsSuggestionCsv(files, {
uploadToolEditSuggestionCsv(files, {
Authorization: `Bearer ${apiToken}`,
}).then(() => {
push("/dashboard");
Expand Down
4 changes: 2 additions & 2 deletions client/src/services/collaborators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function uploadCollaboratorsCsv(
});
}

export function uploadCollaboratorsSuggestionCsv(
export function uploadCollaboratorEditSuggestionsCsv(
data: File[],
headers: { [key: string]: string },
options?: UseQueryOptions<unknown>,
Expand All @@ -68,7 +68,7 @@ export function uploadCollaboratorsSuggestionCsv(
return api
.request({
method: "post",
url: "/collaborators-edit-suggestions/import",
url: "/collaborator-edit-suggestions/import",
data: formData,
headers: {
"Content-Type": "multipart/form-data",
Expand Down
4 changes: 2 additions & 2 deletions client/src/services/other-tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function uploadOtherToolsCsv(
});
}

export function uploadOtherToolsSuggestionCsv(
export function uploadToolEditSuggestionCsv(
data: File[],
headers: { [key: string]: string },
options?: UseQueryOptions<unknown>,
Expand All @@ -69,7 +69,7 @@ export function uploadOtherToolsSuggestionCsv(
return api
.request({
method: "post",
url: "/other-tools-edit-suggestions/import",
url: "/tool-edit-suggestions/import",
data: formData,
headers: {
"Content-Type": "multipart/form-data",
Expand Down
Loading

0 comments on commit bad888f

Please sign in to comment.