Skip to content

Commit

Permalink
временно переделал авторизацию
Browse files Browse the repository at this point in the history
  • Loading branch information
semant1cs committed Dec 14, 2023
1 parent 6245aa9 commit adc47bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 3 additions & 1 deletion frontend/src/components/authentication/AuthForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const AuthForm: React.FC = observer(() => {
}, [isPasswordShows])

const onHandleSubmit = useCallback((data: { login: string, password: string }) => {
authStore.signIn(data.login, data.password).then(() => navigateTo('/map'))
// authStore.signIn(data.login, data.password).then(() => navigateTo('/map'))
authStore.authorize()
navigateTo('/map')
}, [navigateTo])

return (
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/components/mapMenu/SuperUserMap/SuperUserMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ const SuperUserMap: React.FC<ISuperUserMap> = observer(() => {
}


<CustomButton additionalClassName="users-list__btn" handleOnClick={handleOnClickChangeIsModalOpen}
text="Открыть список сотрудников"/>
<CustomButton
additionalClassName="users-list__btn"
handleOnClick={handleOnClickChangeIsModalOpen}
text="Открыть список сотрудников"
/>

{/*<select>*/}
{/* {superUserStore.allUsers.map((user) =>*/}
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/store/authStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class AuthStore {
axios.post("http://localhost:8000/auth/logout").catch(reason => console.log(reason))
}

private unauthorize = () => {
this.isUserAuthorized = false
authorize = () => {
this.isUserAuthorized = true
}

private authorize = () => {
this.isUserAuthorized = true
private unauthorize = () => {
this.isUserAuthorized = false
}

private async signUp(login: string, password: string,) {
private async signUp(login: string, password: string) {
axios.post("http://localhost:8000/auth/register", {
username: login,
password: password
Expand Down

0 comments on commit adc47bd

Please sign in to comment.