Skip to content
Snippets Groups Projects
Commit 8164129a authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

fix type imports

parent 64b0928c
Branches
No related tags found
2 merge requests!19fix type imports,!9update types
import { Profile } from '../types/types';
import { IProfile } from '../types/Profile';
export type EmptyReq = undefined;
......@@ -11,5 +11,5 @@ export type RegisterReq = {
password: string;
};
export type UserResponse = {
user: Profile;
user: IProfile;
};
import React, { createContext, useState } from 'react';
import { Profile, Role } from '../types/types';
import { IProfile, Role } from '../types/Profile';
interface ContextProps {
profile: Profile;
setProfile: (profile: Profile) => void;
profile: IProfile;
setProfile: (profile: IProfile) => void;
}
// Context
const initialState: Profile = {
external_id: 'abcd',
const initialState: IProfile = {
externalId: 'abcd',
studentCardNumber: '1234',
roomNumber: '104',
picture: 'alma.jpg',
roomNumber: 104,
role: Role.User,
email: 'alma@gmail.com',
name: 'Nagy Gizike',
warnings: [],
notices: [],
};
export const userContext = createContext({} as ContextProps);
const { Provider } = userContext;
export const UserStateProvider: React.FC = ({ children }) => {
const [profile, setProfile] = useState<Profile>(initialState);
const [profile, setProfile] = useState<IProfile>(initialState);
return <Provider value={{ profile, setProfile }}>{children}</Provider>;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment