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
No related branches found
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; export type EmptyReq = undefined;
...@@ -11,5 +11,5 @@ export type RegisterReq = { ...@@ -11,5 +11,5 @@ export type RegisterReq = {
password: string; password: string;
}; };
export type UserResponse = { export type UserResponse = {
user: Profile; user: IProfile;
}; };
import React, { createContext, useState } from 'react'; import React, { createContext, useState } from 'react';
import { Profile, Role } from '../types/types'; import { IProfile, Role } from '../types/Profile';
interface ContextProps { interface ContextProps {
profile: Profile; profile: IProfile;
setProfile: (profile: Profile) => void; setProfile: (profile: IProfile) => void;
} }
// Context // Context
const initialState: Profile = { const initialState: IProfile = {
external_id: 'abcd', externalId: 'abcd',
studentCardNumber: '1234', studentCardNumber: '1234',
roomNumber: '104', roomNumber: 104,
picture: 'alma.jpg',
role: Role.User, role: Role.User,
email: 'alma@gmail.com', email: 'alma@gmail.com',
name: 'Nagy Gizike', name: 'Nagy Gizike',
warnings: [], warnings: [],
notices: [],
}; };
export const userContext = createContext({} as ContextProps); export const userContext = createContext({} as ContextProps);
const { Provider } = userContext; const { Provider } = userContext;
export const UserStateProvider: React.FC = ({ children }) => { 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>; 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