Skip to content

Commit

Permalink
fix: fix job modal
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroqs committed Sep 12, 2024
1 parent d729c2f commit 47373a7
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 18 deletions.
16 changes: 3 additions & 13 deletions src/app/providers/auth/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import axios from 'axios'
import { createContext, ReactNode, useContext, useState } from 'react'
import { useNavigate } from 'react-router-dom'

import { RoutePath } from '@/app/providers/router/config'
import { RefereshTokenDto, UserDto } from '@/entities/auth/dto'
import { urlApi } from '@/shared/lib/baseApi'
import { refreshToken } from '@/entities/auth/api'
import { UserDto } from '@/entities/auth/dto'

interface AuthContextProps {
user: UserDto
Expand Down Expand Up @@ -48,16 +47,7 @@ export const AuthProvider = ({ children }: AuthProviderProps) => {
const checkAuthUser = async () => {
setLoading(true)
try {
const response = await axios.post<RefereshTokenDto>(
`${urlApi}/auth/refresh`,
{},
{
headers: {
'Secret-Access-Token': import.meta.env.VITE_BASE_AUTH_KEY,
},
withCredentials: true,
},
)
const response = await refreshToken()
localStorage.setItem('token', response.data.accessToken)
setUser(response.data.user)
setIsAuthenticated(true)
Expand Down
7 changes: 7 additions & 0 deletions src/entities/auth/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AxiosResponse } from 'axios'

import {
RefereshTokenDto,
UserSignInDto,
UserSignInDtoResponse,
UserSignUpContext,
Expand All @@ -20,3 +21,9 @@ export const signUp = async (
): Promise<AxiosResponse<UserSignUpDtoResponse>> => {
return baseApi.post<UserSignUpDtoResponse>('/auth/sign-up', body)
}

export const refreshToken = async (): Promise<
AxiosResponse<RefereshTokenDto>
> => {
return baseApi.get<RefereshTokenDto>('/auth/refresh')
}
2 changes: 1 addition & 1 deletion src/pages/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const formSchemaApplicant = z.object({
.min(50, {
message: 'Должно быть не менее 50 символов',
})
.max(450),
.max(1450),
})

const formSchemaRecruiter = z.object({
Expand Down
File renamed without changes.
Empty file added src/pages/SignIn/model.ts
Empty file.
2 changes: 1 addition & 1 deletion src/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const CreateVacancyPage = lazy(() => import('./CreateVacancy'))
export const ProfilePage = lazy(() => import('./Profile'))
export const CandidateProfilePage = lazy(() => import('./CandidateProfile'))
export const SignUpPage = lazy(() => import('./SignUp/SignUp'))
export const SignInPage = lazy(() => import('./SignIn'))
export const SignInPage = lazy(() => import('./SignIn/SignIn'))
export const ErrorPage = lazy(() => import('./Error'))
export const VacanciesStatisticsPage = lazy(
() => import('./VacanciesStatistics'),
Expand Down
2 changes: 0 additions & 2 deletions src/widgets/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export const LoginForm = () => {
})

const onSubmit = async (values: z.infer<typeof formSchema>) => {
// Do something with the form values.
// ✅ This will be type-safe and validated.
signInUser(values)
}

Expand Down
2 changes: 1 addition & 1 deletion src/widgets/ProfileForm/JobExpirience.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const JobExpirience = ({ user }: JobExperienceProps) => {
</Button>
</DialogTrigger>

<DialogContent className="sm:max-w-[625px]">
<DialogContent className="sm:max-w-[625px] overflow-y-scroll max-h-screen">
<DialogHeader>
<DialogTitle>Добавить место работы</DialogTitle>
<DialogDescription>
Expand Down

0 comments on commit 47373a7

Please sign in to comment.