saleor-dashboard/src/apps/views/AppSettings/AppSettings.tsx
Michał Droń d5c9a3dae8
Add trailing commas (#2062)
* Require trailing commas

* Add trailing commas

* Add trailing commas in testUtils dir

* Add trailing commas
2022-06-21 11:36:55 +02:00

45 lines
1.1 KiB
TypeScript

import { appMessages } from "@saleor/apps/messages";
import NotFoundPage from "@saleor/components/NotFoundPage";
import { useAppQuery } from "@saleor/graphql";
import useNotifier from "@saleor/hooks/useNotifier";
import React from "react";
import { useIntl } from "react-intl";
import AppPage from "../../components/AppPage";
import { appDetailsUrl, appsListPath } from "../../urls";
interface AppSettingsProps {
id: string;
}
export const AppSettings: React.FC<AppSettingsProps> = ({ id }) => {
const { data } = useAppQuery({
displayLoader: true,
variables: { id },
});
const appExists = data?.app !== null;
const notify = useNotifier();
const intl = useIntl();
if (!appExists) {
return <NotFoundPage backHref={appsListPath} />;
}
return (
<AppPage
data={data?.app}
url={data?.app.configurationUrl}
aboutHref={appDetailsUrl(id)}
onError={() =>
notify({
status: "error",
text: intl.formatMessage(appMessages.failedToFetchAppSettings),
})
}
/>
);
};
export default AppSettings;