Ignore:
Timestamp:
01/16/24 16:34:03 (6 months ago)
Author:
darsov2 <62809499+darsov2@…>
Branches:
master
Children:
07f4e8b
Parents:
e6c2521
Message:

revert

Location:
frontend/src/Components/Hooks
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • frontend/src/Components/Hooks/Hotel/useCreateHotel.js

    re6c2521 r5528b99  
    66const useCreateHotel = () => {
    77
     8    //const history = useNavigate();
    89    const createHotel = async (hotel, edit) => {
    910                console.log({hotel})
    1011                console.log(hotel)
    11                 console.log("vo createhotel")
    1212
    1313                if(!edit)
     
    1616                        .post(`/hotel/add`, hotel, {
    1717                                params: {
    18                                         userId: JSON.parse(localStorage.getItem("user")).userId
     18                                        userId: localStorage.getItem("userId")
    1919                                }
    2020                        })
  • frontend/src/Components/Hooks/Restaurant/useCreateRestaurant.js

    re6c2521 r5528b99  
    1515                        .post(`/restaurant/add`, restaurant, {
    1616                                params: {
    17                                         userId: JSON.parse(localStorage.getItem('user')).userId,
     17                                        userId: localStorage.getItem('userId')
    1818                                }
    1919                        })
  • frontend/src/Components/Hooks/Transport/useCreateTransport.js

    re6c2521 r5528b99  
    44
    55const useCreateTransport = () => {
    6         const userId = JSON.parse(localStorage.getItem('user')).userId
     6
    77    const createTransport = async (transport, edit) => {
    88                        if(!edit)
    99                        {
    1010                                await axios
    11                     .post(`/transport/add/` + userId, transport)
     11                    .post(`/transport/add`, transport)
    1212                    .then((res) => {
    1313                        //history.push('/transport');
  • frontend/src/Components/Hooks/User/useLogin.js

    re6c2521 r5528b99  
    44import { Navigate, useAsyncValue, useNavigate } from "react-router-dom";
    55import LoginForm from "../../Login/LoginForm.js";
    6 import {useAuth} from "../../Context/AuthContext";
    76
    87const useLogin = () => {
    98
    109    const navigator = useNavigate()
    11         const Auth = useAuth();
    1210    //const history = useNavigate();
    1311    const login = async (loginData) => {
     
    2422                })
    2523                    .then((res) => {
    26                                         console.log("RES LOGIN")
    27                                         console.log(res)
    28                                         if(res.status === 200)
    29                                         {
    30                                                 const user = {
    31                                                         sessionId: res.data.auth.details.sessionId,
    32                                                         userId: res.data.auth.principal.userID,
    33                                                         username: res.data.auth.principal.username,
    34                                                         role: res.data.auth.principal.role,
    35                                                         name: res.data.auth.principal.name,
    36                                                         surname: res.data.auth.principal.surname,
    37                                                 }
    38                                                 Auth.userLogin(user);
    39                                                 console.log(user)
    40                                         }
    4124                                        const sessionId = res.data.auth.details.sessionId;
    4225                                        const userId = res.data.auth.principal.userID;
    43 
     26                                       
    4427                                        localStorage.setItem("sessionId", sessionId);
    4528                                        localStorage.setItem("userId", userId);
  • frontend/src/Components/Hooks/useGet.js

    re6c2521 r5528b99  
    1111        console.log(localStorage.getItem("sessionId"))
    1212        console.log("url od get " + uurl)
     13<<<<<<< HEAD
    1314        await axios.get(uurl, {maxRedirects: 0}).then((res) => {
    1415            console.log(res);
     
    2223            // window.location.href = '/error'
    2324        })
     25=======
     26        await axios.
     27            get(uurl).then((res) => {
     28                setData(res.data);
     29            }).catch((err) => {
     30                console.log(err)
     31            })
     32>>>>>>> parent of ac19a0c (authContext impl, admin panel impl, search bar fixes, reservations listings impl)
    2433            .finally(() => {
    2534                setIsLoading(false);
     
    3140        getData(url);
    3241    }, [dep, url, changed]);
    33 
     42   
    3443    return {
    3544        data,
Note: See TracChangeset for help on using the changeset viewer.