Last change
on this file since 747e0ab was bc20307, checked in by Tasevski2 <39170279+Tasevski2@…>, 3 years ago |
Push before video
|
-
Property mode
set to
100644
|
File size:
1009 bytes
|
Line | |
---|
1 | import { useState } from 'react';
|
---|
2 | import axios from 'axios';
|
---|
3 |
|
---|
4 | const useGetSessionOverInfo = () => {
|
---|
5 | const [isLoading, setIsLoading] = useState(false);
|
---|
6 | const [totalPrice, setTotalPrice] = useState(null);
|
---|
7 |
|
---|
8 | const getSessionInfoOver = async () => {
|
---|
9 | setIsLoading(true);
|
---|
10 | await axios
|
---|
11 | .get(`/parkingSession/end/calculate`)
|
---|
12 | .then((res) => {
|
---|
13 | // setTimeAndSessionPrice({totalTime: res.data.totalTime, totalPrice: res.data.totalPrice});
|
---|
14 | setTotalPrice(res.data);
|
---|
15 | })
|
---|
16 | .catch((err) => {
|
---|
17 | // setAlert({
|
---|
18 | // type: 'error',
|
---|
19 | // msg: 'Проблеми со серверот!', // TODO change msg to err.message
|
---|
20 | // });
|
---|
21 | })
|
---|
22 | .finally(() => {
|
---|
23 | setIsLoading(false);
|
---|
24 | });
|
---|
25 | };
|
---|
26 |
|
---|
27 | return {
|
---|
28 | getSessionInfoOver,
|
---|
29 | isLoading,
|
---|
30 | totalPrice,
|
---|
31 | };
|
---|
32 | };
|
---|
33 |
|
---|
34 | export default useGetSessionOverInfo;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.