Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SK.API/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Database=socialKnow;Username=postgres;Password=1234"
"DefaultConnection": "Host=localhost;Database=socialKnow;Username=postgres;Password=44r57atv"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't add your password to commit

},
"Logging": {
"LogLevel": {
Expand Down
11,860 changes: 11,860 additions & 0 deletions SK.WebApp/package-lock.json

Large diffs are not rendered by default.

Empty file.
2 changes: 2 additions & 0 deletions SK.WebApp/src/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const apiAddress = 'https://localhost:44324';

export enum anyEndpointKeys {
login = 'LOGIN',
register = 'REGISTER',
}

export type endpointMap = {
Expand All @@ -11,6 +12,7 @@ export type endpointMap = {

export const anyEndpoint: endpointMap = {
LOGIN: '/{languageCode}/api/User/login',
REGISTER: '/{languageCode}/api/User/register',
};

interface getEndpointWithLanguageCodeArgs {
Expand Down
1 change: 1 addition & 0 deletions SK.WebApp/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { useInterval } from '../hooks/useInterval';
import { DefaultLayout } from '../components/Layout/DefaultLayout';
import { Typography } from '../components/Typography/Typography';
import { userRegister } from '../userRegister';

export const Home = () => {
const dispatch = useAppDispatch();
Expand Down
44 changes: 44 additions & 0 deletions SK.WebApp/src/userRegister.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

import { anyEndpointKeys, getEndpointWithLanguageCode } from './endpoints';
import { anyLangageCodeKeys } from './languages';

export type RegisterToApiRequest = {
username: string;
email: string;
password: string;
};

export type RegisterToApiResponse = {
username: string;
token: string;
image: string;
};



export const userRegister = async ({
username,
email,
password,
}: RegisterToApiRequest): Promise<RegisterToApiResponse | undefined> => {

const apiUrl = getEndpointWithLanguageCode({
endpointKey: anyEndpointKeys.register,
languageCodeKey: anyLangageCodeKeys.english
})

try {
const response = await fetch(apiUrl, {
method: 'POST',
mode: 'cors',
headers: {
'Conent-Type': 'application/json',
},
body: JSON.stringify({username, email, password})
});

return response.json();
} catch (error) {
console.warn('Register failed.', error);
}
}
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
7 changes: 7 additions & 0 deletions workspace.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"folders": [
{
"path": "."
}
]
}