{"size": 1678, "ext": "js", "max_stars_repo_path": "pages/admin/trusts/[id]/edit-success.js", "max_stars_repo_name": "nax2uk/NHS-VV", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "pages/admin/trusts/[id]/edit-success.js", "max_issues_repo_name": "nax2uk/NHS-VV", "max_issues_repo_issues_event_min_datetime": "2020-10-28T17:04:54.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-28T17:04:54.000Z", "max_forks_repo_path": "pages/admin/trusts/[id]/edit-success.js", "max_forks_repo_name": "Kettering-General-Hospital/nhs-virtual-visit", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 27.9666666667, "max_line_length": 106, "alphanum_fraction": 0.5822407628}
import React from "react";
import Error from "next/error";
import Layout from "../../../../src/components/Layout";
import AnchorLink from "../../../../src/components/AnchorLink";
import propsWithContainer from "../../../../src/middleware/propsWithContainer";
import verifyAdminToken from "../../../../src/usecases/verifyAdminToken";
import { ADMIN } from "../../../../src/helpers/userTypes";

const EditATrustSuccess = ({ error, trust }) => {
  if (error) {
    return <Error />;
  }

  return (
    <Layout
      title={`${trust.name} has been updated`}
      showNavigationBarForType={ADMIN}
      showNavigationBar={true}
    >
      <div className="nhsuk-grid-row">
        <div className="nhsuk-grid-column-two-thirds">
          <div
            className="nhsuk-panel nhsuk-panel--confirmation nhsuk-u-margin-top-0 nhsuk-u-margin-bottom-4"
            style={{ textAlign: "center" }}
          >
            <h1 className="nhsuk-panel__title">
              {trust.name} has been updated
            </h1>
          </div>
          <h2>What happens next</h2>

          <p>
            <AnchorLink href="/admin">Return to site administration</AnchorLink>
          </p>
        </div>
      </div>
    </Layout>
  );
};

export const getServerSideProps = propsWithContainer(
  verifyAdminToken(async ({ container, query }) => {
    const getRetrieveTrustById = container.getRetrieveTrustById();
    const { trust, error } = await getRetrieveTrustById(query.id);

    if (error) {
      return { props: { error: error } };
    } else {
      return {
        props: {
          trust,
          error,
        },
      };
    }
  })
);

export default EditATrustSuccess;
