diff --git a/SK.WebApp/src/getLoggedUser.ts b/SK.WebApp/src/getLoggedUser.ts new file mode 100644 index 0000000..85f78ca --- /dev/null +++ b/SK.WebApp/src/getLoggedUser.ts @@ -0,0 +1,23 @@ + +export type GetLoggedUserResponse = { + username: string; + token: string; + image: string; +}; + +export const getLoggedUser = async (): Promise => { + + try { + const response = await fetch(`localhost:5001/${navigator.language}/api/User`, { + method: 'GET', + mode: 'cors', + headers: { + 'Content-Type': 'application/json', + }, + }); + + return response.json(); + } catch (error) { + console.warn('Login was failed.', error); + } +}; diff --git a/SK.WebApp/src/pages/Home.tsx b/SK.WebApp/src/pages/Home.tsx index 1ee77e9..a30533e 100644 --- a/SK.WebApp/src/pages/Home.tsx +++ b/SK.WebApp/src/pages/Home.tsx @@ -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(); diff --git a/workspace.code-workspace b/workspace.code-workspace new file mode 100644 index 0000000..876a149 --- /dev/null +++ b/workspace.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": {} +} \ No newline at end of file