mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-24 01:12:54 -04:00
28 lines
774 B
TypeScript
28 lines
774 B
TypeScript
import { BaseAPI } from "../_base";
|
|
import { ReportSummary } from "~/types/api-types/reports";
|
|
import { SupportedMigrations } from "~/types/api-types/group";
|
|
|
|
const prefix = "/api";
|
|
export interface MigrationPayload {
|
|
addMigrationTag: boolean;
|
|
migrationType: SupportedMigrations;
|
|
archive: File;
|
|
}
|
|
|
|
const routes = {
|
|
base: `${prefix}/groups/migrations`,
|
|
};
|
|
|
|
export class GroupMigrationApi extends BaseAPI {
|
|
async startMigration(payload: MigrationPayload) {
|
|
const form = new FormData();
|
|
form.append("add_migration_tag", String(payload.addMigrationTag));
|
|
form.append("migration_type", payload.migrationType);
|
|
form.append("archive", payload.archive);
|
|
|
|
console.log(form);
|
|
|
|
return await this.requests.post<ReportSummary>(routes.base, form);
|
|
}
|
|
}
|