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