test to test
This commit is contained in:
parent
68667e55de
commit
a3438586bd
@ -162,7 +162,7 @@ export default function ({ handleTransfer }: TopbarProps) {
|
||||
<FlexboxColumn>
|
||||
<ClickAwayListener onClickAway={handleCloseDropdown}>
|
||||
<Flexbox>
|
||||
<SelectMenu changeSelectedOption={changeSelectedOption} selectedOption={selectedOption} changeDropdownOpen={setOpen}/>
|
||||
{/* <SelectMenu changeSelectedOption={changeSelectedOption} selectedOption={selectedOption} changeDropdownOpen={setOpen}/> */}
|
||||
<InputWrapper>
|
||||
<Input
|
||||
placeholder={`Wyszukaj ${selectedOption === "studenci" ? "studentów..." : "przedmioty..."}`}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect, createContext, ReactNode } from 'react';
|
||||
import { User } from '../types';
|
||||
import { User, Token } from '../types';
|
||||
import { axiosInstance } from '../utils/axiosInstance';
|
||||
|
||||
export interface CASContext {
|
||||
@ -27,10 +27,16 @@ export const CASProvider = ({ children }: CASProviderProps) => {
|
||||
try {
|
||||
if (!sessionStorage.getItem('userToken')) {
|
||||
const { data: token } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/token?ticket=${ticket}`);
|
||||
sessionStorage.setItem('userToken', token);
|
||||
sessionStorage.setItem('userToken', token.token);
|
||||
}
|
||||
const token = sessionStorage.getItem('userToken');
|
||||
setToken(token);
|
||||
const tokenik:any = JSON.parse(sessionStorage.getItem('userToken')as string);
|
||||
const token: Token = {
|
||||
authorityRole: tokenik.authorityRole,
|
||||
email: tokenik.email,
|
||||
id: tokenik.id,
|
||||
token: tokenik.token,
|
||||
};
|
||||
setToken(token.token);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export const UsersProvider = ({ children }: UsersProviderProps) => {
|
||||
|
||||
const getUsers = async () => {
|
||||
try {
|
||||
const {data}= await axiosInstance.get<Array<User>>(`${process.env.REACT_APP_API_URL}/api/v1/users/student/search?query=`);
|
||||
const {data}= await axiosInstance.get<Array<User>>(`${process.env.REACT_APP_API_URL}/api/v1/users/students`);
|
||||
setUsers(data);
|
||||
console.log(data);
|
||||
} catch(e){
|
||||
|
@ -27,6 +27,13 @@ export interface Course {
|
||||
classes?: Array<Group>;
|
||||
}
|
||||
|
||||
export interface Token {
|
||||
authorityRole: string,
|
||||
email: string,
|
||||
id: number,
|
||||
token: string,
|
||||
}
|
||||
|
||||
export interface User {
|
||||
email: string;
|
||||
id: number;
|
||||
|
Loading…
Reference in New Issue
Block a user