Add studentId
This commit is contained in:
parent
5d999ea9c8
commit
7fe646a875
@ -22,6 +22,8 @@ const Login = () => {
|
|||||||
const [userId, setUserId] = useLocalStorageState('userId', {
|
const [userId, setUserId] = useLocalStorageState('userId', {
|
||||||
defaultValue: -1,
|
defaultValue: -1,
|
||||||
})
|
})
|
||||||
|
const [studentId, setStudentId] = useLocalStorageState('studentId')
|
||||||
|
|
||||||
const [userType, setUserType] = useLocalStorageState('userType', {
|
const [userType, setUserType] = useLocalStorageState('userType', {
|
||||||
defaultValue: 'coordinator',
|
defaultValue: 'coordinator',
|
||||||
})
|
})
|
||||||
@ -66,19 +68,22 @@ const Login = () => {
|
|||||||
{
|
{
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
setLeaderOptions(
|
setLeaderOptions(
|
||||||
data?.data.project_supervisors.map(({ first_name, last_name, id }) => {
|
data?.data.project_supervisors.map(
|
||||||
|
({ first_name, last_name, id }) => {
|
||||||
return {
|
return {
|
||||||
value: id,
|
value: id,
|
||||||
label: `${first_name} ${last_name}`,
|
label: `${first_name} ${last_name}`,
|
||||||
}
|
}
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const onStudentChange = (v: any) => {
|
const onStudentChange = (v: any) => {
|
||||||
setUserId(v.value)
|
setStudentId(v.value)
|
||||||
|
// setUserId(v.value)
|
||||||
setUserType('student')
|
setUserType('student')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +136,7 @@ const Login = () => {
|
|||||||
<Select
|
<Select
|
||||||
closeMenuOnSelect={true}
|
closeMenuOnSelect={true}
|
||||||
options={leaderOptions}
|
options={leaderOptions}
|
||||||
placeholder="Wybierz studenta"
|
placeholder="Wybierz opiekuna"
|
||||||
onChange={onLeaderChange}
|
onChange={onLeaderChange}
|
||||||
styles={{
|
styles={{
|
||||||
control: (styles: any) => ({
|
control: (styles: any) => ({
|
||||||
@ -162,10 +167,15 @@ const Login = () => {
|
|||||||
Zaloguj
|
Zaloguj
|
||||||
</button>
|
</button>
|
||||||
<div className="flex flex-col mt-3">
|
<div className="flex flex-col mt-3">
|
||||||
<span onClick={() => {
|
<span
|
||||||
|
onClick={() => {
|
||||||
setUserType('coordinator')
|
setUserType('coordinator')
|
||||||
navigate("/coordinator")
|
navigate('/coordinator')
|
||||||
}} className="cursor-pointer">Koordynator</span>
|
}}
|
||||||
|
className="cursor-pointer"
|
||||||
|
>
|
||||||
|
Koordynator
|
||||||
|
</span>
|
||||||
{/* <NavLink to="/student">Student</NavLink> */}
|
{/* <NavLink to="/student">Student</NavLink> */}
|
||||||
{/* <NavLink to="/supervisor">Opiekun</NavLink> */}
|
{/* <NavLink to="/supervisor">Opiekun</NavLink> */}
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,7 +23,7 @@ const ScheduleAddGroup = ({
|
|||||||
const { register, handleSubmit, reset, control } = useForm<{
|
const { register, handleSubmit, reset, control } = useForm<{
|
||||||
student_index: number
|
student_index: number
|
||||||
}>({ mode: 'onBlur' })
|
}>({ mode: 'onBlur' })
|
||||||
const [studentId] = useLocalStorageState('userId')
|
const [studentId] = useLocalStorageState('studentId')
|
||||||
|
|
||||||
const { mutate: mutateAssignGroup } = useMutation(
|
const { mutate: mutateAssignGroup } = useMutation(
|
||||||
['assignGroup'],
|
['assignGroup'],
|
||||||
|
@ -24,7 +24,7 @@ const customStyles = {
|
|||||||
const localizer = dayjsLocalizer(dayjs)
|
const localizer = dayjsLocalizer(dayjs)
|
||||||
|
|
||||||
const StudentSchedule = () => {
|
const StudentSchedule = () => {
|
||||||
const [studentId] = useLocalStorageState('userId')
|
const [studentId] = useLocalStorageState('studentId')
|
||||||
const { id } = useParams<{ id: string }>()
|
const { id } = useParams<{ id: string }>()
|
||||||
const [events, setEvents] = useState<
|
const [events, setEvents] = useState<
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user