45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
import React, { Component } from "react";
|
|
|
|
import ReportSingleMigration from "../common/Forms/ReportSingleMigration";
|
|
import { callAPI } from "../../actions/API";
|
|
|
|
// /migrations in the address bar,
|
|
// Allows the modification of migrations, and also populating a form
|
|
// by UUID,
|
|
// ReportSingleMigration is the actual form, witha PUT API request on that page.
|
|
|
|
export default class Migrations extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
migs: [],
|
|
redirect: false,
|
|
};
|
|
}
|
|
|
|
render() {
|
|
const onSubmit = async (migrationId, { setSubmitting }) => {
|
|
callAPI
|
|
.get(`/${migrationId.migrationId}/`)
|
|
.then((response) =>
|
|
this.setState({
|
|
redirect: true,
|
|
migs: response.data,
|
|
})
|
|
)
|
|
.catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
setSubmitting(false);
|
|
};
|
|
return (
|
|
<div>
|
|
<ReportSingleMigration
|
|
key={this.state.migs.id}
|
|
item={this.state.migs}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|