@@ -59,13 +57,13 @@ export const ProfileSettingsPage = (props: PageProps) => {
Представление
-
+
О себе
-
+
diff --git a/src/components/Root.tsx b/src/components/Root.tsx
index 4eb927ac..75a470f5 100644
--- a/src/components/Root.tsx
+++ b/src/components/Root.tsx
@@ -33,7 +33,6 @@ import { InboxPage } from './Pages/InboxPage'
import { LayoutShoutsPage } from './Pages/LayoutShoutsPage'
import { SessionProvider } from '../context/session'
import { ProfileSettingsPage } from './Pages/profile/ProfileSettingsPage'
-import { ProfilePage } from './Pages/profile/ProfilePage'
// TODO: lazy load
// const SomePage = lazy(() => import('./Pages/SomePage'))
@@ -61,8 +60,7 @@ const pagesMap: Record
> = {
principles: PrinciplesPage,
termsOfUse: TermsOfUsePage,
thanks: ThanksPage,
- profileSettings: ProfileSettingsPage,
- profile: ProfilePage
+ profileSettings: ProfileSettingsPage
}
export const Root = (props: PageProps) => {
diff --git a/src/context/session.tsx b/src/context/session.tsx
index 47a51e76..73971cb9 100644
--- a/src/context/session.tsx
+++ b/src/context/session.tsx
@@ -6,6 +6,7 @@ import { resetToken, setToken } from '../graphql/privateGraphQLClient'
type SessionContextType = {
session: InitializedResource
+ userSlug: Accessor
isAuthenticated: Accessor
actions: {
refreshSession: () => AuthResult | Promise
@@ -42,6 +43,8 @@ export const SessionProvider = (props: { children: JSX.Element }) => {
initialValue: null
})
+ const userSlug = createMemo(() => session()?.user?.slug)
+
const isAuthenticated = createMemo(() => Boolean(session()?.user?.slug))
const signIn = async ({ email, password }: { email: string; password: string }) => {
@@ -71,7 +74,7 @@ export const SessionProvider = (props: { children: JSX.Element }) => {
confirmEmail
}
- const value: SessionContextType = { session, isAuthenticated, actions }
+ const value: SessionContextType = { session, userSlug, isAuthenticated, actions }
onMount(() => {
refetchRefreshSession()
diff --git a/src/stores/router.ts b/src/stores/router.ts
index 7a960fb6..d69c180a 100644
--- a/src/stores/router.ts
+++ b/src/stores/router.ts
@@ -27,7 +27,6 @@ export interface Routes {
thanks: void
expo: 'layout'
inbox: void // TODO: добавить ID текущего юзера
- profile: void
profileSettings: void
}
@@ -56,7 +55,6 @@ const routerStore = createRouter(
termsOfUse: '/about/terms-of-use',
thanks: '/about/thanks',
expo: '/expo/:layout',
- profile: '/profile',
profileSettings: '/profile/settings'
},
{