generated from yandex-praktikum/middle.messenger.praktikum.yandex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from KomAnw/sprint_3
Sprint 3
- Loading branch information
Showing
96 changed files
with
2,978 additions
and
867 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
.parcel-cache | ||
dist | ||
todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ | |
|
||
[build] | ||
publish = "dist" | ||
[[redirects]] | ||
from = "/*" | ||
to = "/index.html" | ||
status = 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import Fetch from 'src/modules/Fetch/Fetch'; | ||
import addInstancePath from 'src/utils/generateUrl'; | ||
import {AUTH} from '../constants'; | ||
import {AuthOperations} from './types'; | ||
import {FetchOptions, METHODS} from 'src/modules/Fetch/types'; | ||
import {ContentTypes} from '../types'; | ||
import {RegistrationFormData} from 'src/pages/Registration/types'; | ||
import {LoginFormData} from 'src/pages/Login/types'; | ||
|
||
const {POST} = METHODS; | ||
const {applicationJSON} = ContentTypes; | ||
const generateUrl = addInstancePath(AUTH); | ||
|
||
const basePostOptions: FetchOptions = { | ||
methodType: POST, | ||
headers: { | ||
'content-type': applicationJSON, | ||
}, | ||
}; | ||
|
||
export const signup = async (data: RegistrationFormData) => { | ||
const url = generateUrl(AuthOperations.signup); | ||
const options: FetchOptions = { | ||
...basePostOptions, | ||
data: JSON.stringify(data), | ||
}; | ||
|
||
const response = await Fetch(url, options); | ||
return response; | ||
}; | ||
|
||
export const signin = async (data: LoginFormData) => { | ||
const url = generateUrl(AuthOperations.signin); | ||
const options: FetchOptions = { | ||
...basePostOptions, | ||
data: JSON.stringify(data), | ||
}; | ||
|
||
const response = await Fetch(url, options); | ||
return response; | ||
}; | ||
|
||
export const getUserInfo = async () => { | ||
const url = generateUrl(AuthOperations.user); | ||
|
||
const response = await Fetch(url); | ||
return response; | ||
}; | ||
|
||
export const logout = async () => { | ||
const url = generateUrl(AuthOperations.logout); | ||
|
||
const response = await Fetch(url, basePostOptions); | ||
return response; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* eslint-disable */ | ||
export enum AuthOperations { | ||
signup = "signup", | ||
signin = "signin", | ||
user = "user", | ||
logout = "logout", | ||
} |
Oops, something went wrong.