diff --git a/front/app/orgs/[orgslug]/settings/account/passwords/page.tsx b/front/app/orgs/[orgslug]/settings/account/passwords/page.tsx index 4bca9638..af13c2b2 100644 --- a/front/app/orgs/[orgslug]/settings/account/passwords/page.tsx +++ b/front/app/orgs/[orgslug]/settings/account/passwords/page.tsx @@ -1,77 +1,30 @@ -"use client"; -import { AuthContext } from '@components/Security/AuthProvider'; -import React, { useEffect } from 'react' -import { Formik, Form, Field, ErrorMessage } from 'formik'; -import { updateProfile } from '@services/settings/profile'; -import { updatePassword } from '@services/settings/password'; +import { getOrganizationContextInfo } from "@services/organizations/orgs"; +import { Metadata } from "next"; +import PasswordsClient from "./passwords"; + +type MetadataProps = { + params: { orgslug: string }; + searchParams: { [key: string]: string | string[] | undefined }; +}; + +export async function generateMetadata( + { params }: MetadataProps, +): Promise { + + // Get Org context information + const org = await getOrganizationContextInfo(params.orgslug, { revalidate: 1800, tags: ['organizations'] }); + return { + title: `Settings: Passwords — ${org.name}`, + description: org.description, + }; +} function SettingsProfilePasswordsPage() { - - const auth: any = React.useContext(AuthContext); - - const updatePasswordUI = async (values: any) => { - let user_id = auth.userInfo.user_object.user_id; - console.log(values); - await updatePassword(user_id, values) - } - - - return ( -
- - {auth.isAuthenticated && ( -
-

Account Password

-

- - { - setTimeout(() => { - alert(JSON.stringify(values, null, 2)); - setSubmitting(false); - updatePasswordUI(values) - }, 400); - }} - > - {({ isSubmitting }) => ( -
- - - - - - - - - - )} -
-
- )} - - -
- - ) + return ( + <> + + + ) } export default SettingsProfilePasswordsPage \ No newline at end of file diff --git a/front/app/orgs/[orgslug]/settings/account/passwords/passwords.tsx b/front/app/orgs/[orgslug]/settings/account/passwords/passwords.tsx new file mode 100644 index 00000000..c2254a34 --- /dev/null +++ b/front/app/orgs/[orgslug]/settings/account/passwords/passwords.tsx @@ -0,0 +1,77 @@ +"use client"; +import { AuthContext } from '@components/Security/AuthProvider'; +import React, { useEffect } from 'react' +import { Formik, Form, Field, ErrorMessage } from 'formik'; +import { updatePassword } from '@services/settings/password'; + + +function PasswordsClient() { + const auth: any = React.useContext(AuthContext); + + console.log('auth', auth) + + const updatePasswordUI = async (values: any) => { + let user_id = auth.userInfo.user_object.user_id; + await updatePassword(user_id, values) + } + + + return ( +
+ + {auth.isAuthenticated && ( +
+

Account Password

+

+ + { + setTimeout(() => { + alert(JSON.stringify(values, null, 2)); + setSubmitting(false); + updatePasswordUI(values) + }, 400); + }} + > + {({ isSubmitting }) => ( +
+ + + + + + + + + + )} +
+
+ )} + + +
+ + ) +} + +export default PasswordsClient \ No newline at end of file diff --git a/front/app/orgs/[orgslug]/settings/account/profile/page.tsx b/front/app/orgs/[orgslug]/settings/account/profile/page.tsx index ea0e297b..31139edc 100644 --- a/front/app/orgs/[orgslug]/settings/account/profile/page.tsx +++ b/front/app/orgs/[orgslug]/settings/account/profile/page.tsx @@ -1,79 +1,26 @@ -"use client"; -import { AuthContext } from '@components/Security/AuthProvider'; -import React, { useEffect } from 'react' -import { Formik, Form, Field, ErrorMessage } from 'formik'; -import { updateProfile } from '@services/settings/profile'; +import { getOrganizationContextInfo } from "@services/organizations/orgs"; +import { Metadata } from "next"; +import ProfileClient from "./profile"; + +type MetadataProps = { + params: { orgslug: string }; + searchParams: { [key: string]: string | string[] | undefined }; +}; + +export async function generateMetadata( + { params }: MetadataProps, +): Promise { + + // Get Org context information + const org = await getOrganizationContextInfo(params.orgslug, { revalidate: 1800, tags: ['organizations'] }); + return { + title: `Settings: Profile — ${org.name}`, + description: org.description, + }; +} function SettingsProfilePage() { - const auth: any = React.useContext(AuthContext); - - return ( -
- - {auth.isAuthenticated && ( -
-

Profile Settings

-

- - { - setTimeout(() => { - alert(JSON.stringify(values, null, 2)); - setSubmitting(false); - updateProfile(values) - }, 400); - }} - > - {({ isSubmitting }) => ( -
- - - - - - - - - - - - - )} -
-
- )} - - -
- - ) + return } export default SettingsProfilePage \ No newline at end of file diff --git a/front/app/orgs/[orgslug]/settings/account/profile/profile.tsx b/front/app/orgs/[orgslug]/settings/account/profile/profile.tsx new file mode 100644 index 00000000..8423de4f --- /dev/null +++ b/front/app/orgs/[orgslug]/settings/account/profile/profile.tsx @@ -0,0 +1,79 @@ +"use client"; +import { AuthContext } from '@components/Security/AuthProvider'; +import React, { useEffect } from 'react' +import { Formik, Form, Field, ErrorMessage } from 'formik'; +import { updateProfile } from '@services/settings/profile'; + +function ProfileClient() { + const auth: any = React.useContext(AuthContext); + + return ( +
+ + {auth.isAuthenticated && ( +
+

Profile Settings

+

+ + { + setTimeout(() => { + alert(JSON.stringify(values, null, 2)); + setSubmitting(false); + updateProfile(values) + }, 400); + }} + > + {({ isSubmitting }) => ( +
+ + + + + + + + + + + + + )} +
+
+ )} + + +
+ + ) +} + +export default ProfileClient \ No newline at end of file