settings.tsx 873 B

12345678910111213141516171819202122232425262728
  1. import React from 'react';
  2. import type {LoaderFunction} from '@remix-run/node'; // or cloudflare/deno
  3. import {Outlet} from '@remix-run/react';
  4. import {useLoaderData} from '@remix-run/react';
  5. import {json} from '@remix-run/node';
  6. import SettingsLayout from 'app/components/SettingsLayout';
  7. import {Organization, User} from 'sentry/types';
  8. import {fetchData} from 'app/utils/serverApi';
  9. export const loader: LoaderFunction = async ({request}) => {
  10. const [organization, user] = await Promise.all([
  11. fetchData(request, '/users/me/last-organization/'),
  12. fetchData(request, '/users/me/'),
  13. ]);
  14. return json({organization, user, url: request.url});
  15. };
  16. export default function SettingsIndexWrapper() {
  17. const data = useLoaderData<{organization: Organization; user: User}>();
  18. return (
  19. <div>
  20. <SettingsLayout {...data} />
  21. <Outlet />
  22. </div>
  23. );
  24. }