fix integration
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
import axios from "axios";
|
||||
import {useAuthStore} from "@/store/authStore";
|
||||
|
||||
const API_URL = "https://testowe.zikor.pl/api/v1";
|
||||
|
||||
export async function listCategories() {
|
||||
|
||||
const { token } = useAuthStore.getState();
|
||||
const headers = token ? { 'Authorization': `Bearer ${token}` } : {};
|
||||
|
||||
try {
|
||||
const response = await axios.get(`${API_URL}/vars/categories`);
|
||||
const response = await axios.get(`${API_URL}/vars/categories`, { headers });
|
||||
return response.data;
|
||||
} catch (err) {
|
||||
console.error("Nie udało się pobrać listy kategorii.", err.response.status);
|
||||
|
||||
@@ -2,9 +2,9 @@ import axios from "axios";
|
||||
import FormData from 'form-data'
|
||||
import {useAuthStore} from "@/store/authStore";
|
||||
|
||||
// const API_URL = "https://testowe.zikor.pl/api/v1";
|
||||
const API_URL = "https://testowe.zikor.pl/api/v1";
|
||||
|
||||
const API_URL = "http://10.0.2.2:8080/api/v1";
|
||||
//const API_URL = "http://10.0.2.2:8080/api/v1";
|
||||
|
||||
export async function listNotices() {
|
||||
const { token } = useAuthStore.getState();
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import axios from "axios";
|
||||
import {useAuthStore} from "@/store/authStore";
|
||||
// import FormData from 'form-data'
|
||||
|
||||
const API_URL = "https://testowe.zikor.pl/api/v1/wishlist";
|
||||
|
||||
export async function toggleNoticeStatus(noticeId) {
|
||||
const { token } = useAuthStore.getState();
|
||||
const headers = token ? { 'Authorization': `Bearer ${token}` } : {};
|
||||
|
||||
try {
|
||||
const response = await axios.post(`${API_URL}/toggle/${noticeId}`, null, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
const response = await axios.post(`${API_URL}/toggle/${noticeId}`, {}, {
|
||||
headers
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
@@ -18,8 +20,11 @@ export async function toggleNoticeStatus(noticeId) {
|
||||
}
|
||||
|
||||
export async function getWishlist() {
|
||||
const { token } = useAuthStore.getState();
|
||||
const headers = token ? { 'Authorization': `Bearer ${token}` } : {};
|
||||
|
||||
try {
|
||||
const response = await axios.get(`${API_URL}/`);
|
||||
const response = await axios.get(`${API_URL}/`, {headers});
|
||||
console.log("Wishlist response:", response.data);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user