Ekran logowania i rejestracja działa! Tylko wewnętrzne logowanie, bez google

This commit is contained in:
2025-06-04 15:41:40 +02:00
parent 9962dc1e55
commit 1862b6b79e
8 changed files with 418 additions and 73 deletions

View File

@@ -1,12 +1,21 @@
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://172.20.10.2:8080/api/v1";
const API_URL = "http://10.0.2.2:8080/api/v1";
export async function listNotices() {
const response = await fetch(`${API_URL}/notices/get/all`);
const { token } = useAuthStore.getState();
const headers = token ? { 'Authorization': `Bearer ${token}` } : {};
console.log(token);
const response = await fetch(`${API_URL}/notices/get/all`, {
headers: headers
});
console.log(response);
const data = await response.json();
if (!response.ok) {
throw new Error(response.toString());
@@ -17,11 +26,11 @@ export async function listNotices() {
export async function getNoticeById(noticeId) {
const response = await fetch(`${API_URL}/notices/get/${noticeId}`);
const data = await response.json();
if (!response.ok) {
throw new Error("Error");
}
return data;
const data = await response.json();
if (!response.ok) {
throw new Error("Error");
}
return data;
}
export async function createNotice(notice) {