@@ -41,15 +41,14 @@ const getUsers = async (
4141 setData : SetStateCallback < UserData [ ] > ,
4242 setAuth : SetStateCallback < boolean > ,
4343 setErrorMessage : SetStateCallback < string > ,
44- query : Record < string , string > = { } ,
4544) : Promise < void > => {
46- const url = new URL ( `${ API_BASE } /api/v1/user` ) ;
47- url . search = new URLSearchParams ( query ) . toString ( ) ;
48-
4945 setIsLoading ( true ) ;
5046
5147 try {
52- const response : AxiosResponse < UserData [ ] > = await axios ( url . toString ( ) , getAxiosConfig ( ) ) ;
48+ const response : AxiosResponse < UserData [ ] > = await axios (
49+ `${ API_BASE } /api/v1/user` ,
50+ getAxiosConfig ( ) ,
51+ ) ;
5352 setData ( response . data ) ;
5453 } catch ( error ) {
5554 if ( axios . isAxiosError ( error ) ) {
@@ -70,10 +69,8 @@ const getUsers = async (
7069
7170const updateUser = async ( data : UserData ) : Promise < void > => {
7271 console . log ( data ) ;
73- const url = new URL ( `${ API_BASE } /api/auth/gitAccount` ) ;
74-
7572 try {
76- await axios . post ( url . toString ( ) , data , getAxiosConfig ( ) ) ;
73+ await axios . post ( ` ${ API_BASE } /api/auth/gitAccount` , data , getAxiosConfig ( ) ) ;
7774 } catch ( error ) {
7875 const axiosError = error as AxiosError ;
7976 if ( axiosError . response ) {
@@ -89,10 +86,11 @@ const getUserLoggedIn = async (
8986 setIsError : SetStateCallback < boolean > ,
9087 setAuth : SetStateCallback < boolean > ,
9188) : Promise < void > => {
92- const url = new URL ( `${ API_BASE } /api/auth/me` ) ;
93-
9489 try {
95- const response : AxiosResponse < UserData > = await axios ( url . toString ( ) , getAxiosConfig ( ) ) ;
90+ const response : AxiosResponse < UserData > = await axios (
91+ `${ API_BASE } /api/auth/me` ,
92+ getAxiosConfig ( ) ,
93+ ) ;
9694 const data = response . data ;
9795 setIsLoading ( false ) ;
9896 setIsAdmin ( data . admin || false ) ;
0 commit comments