Order zwracał 403, bo nie było headerów

Zdjęcia nie były centerowane względem szerokości
This commit is contained in:
2025-06-10 11:24:08 +02:00
parent c0b8800f83
commit 8f72f28566
5 changed files with 36 additions and 32 deletions

View File

@@ -27,7 +27,6 @@ export async function createOrder(noticeId, orderType) {
export async function createPayment(orderId) { export async function createPayment(orderId) {
const { token } = useAuthStore.getState(); const { token } = useAuthStore.getState();
const headers = token ? { Authorization: `Bearer ${token}` } : {}; const headers = token ? { Authorization: `Bearer ${token}` } : {};
const clientId = 1;
try { try {
const response = await axios.post( const response = await axios.post(
`${API_URL}/token?orderId=${orderId}`, `${API_URL}/token?orderId=${orderId}`,
@@ -48,7 +47,7 @@ export async function getOrder(orderId) {
const headers = token ? { Authorization: `Bearer ${token}` } : {}; const headers = token ? { Authorization: `Bearer ${token}` } : {};
try { try {
const response = await axios.get(`${API_URL}/get/${orderId}`, { headers }); const response = await axios.get(`${API_URL}/get/${orderId}`, { headers: headers });
return response.data; return response.data;
} catch (error) { } catch (error) {
console.error( console.error(
@@ -65,7 +64,7 @@ export async function listOrders() {
const headers = token ? { Authorization: `Bearer ${token}` } : {}; const headers = token ? { Authorization: `Bearer ${token}` } : {};
try { try {
const response = await axios.get(`${API_URL}/get/all`, { headers }); const response = await axios.get(`${API_URL}/get/all`, { headers: headers });
return response.data; return response.data;
} catch (error) { } catch (error) {
console.error( console.error(

View File

@@ -1,7 +1,7 @@
import React, {useEffect, useState} from 'react'; import React, {useEffect, useState} from 'react';
import {StyleSheet, ActivityIndicator, SafeAreaView, View, Platform} from 'react-native'; import {StyleSheet, ActivityIndicator, SafeAreaView, View, Platform} from 'react-native';
import {useAuthStore} from '@/store/authStore'; import {useAuthStore} from '@/store/authStore';
import {useRouter, Link} from 'expo-router'; import {useRouter} from 'expo-router';
import {Box} from "@/components/ui/box" import {Box} from "@/components/ui/box"
import {Button, ButtonText, ButtonIcon} from "@/components/ui/button" import {Button, ButtonText, ButtonIcon} from "@/components/ui/button"
@@ -73,6 +73,7 @@ export default function Login() {
user = await getUserInfo(response.authentication.accessToken) user = await getUserInfo(response.authentication.accessToken)
await signInWithGoogle(response.authentication.accessToken); await signInWithGoogle(response.authentication.accessToken);
alert(`Zalogowano jako ${user.email}`); alert(`Zalogowano jako ${user.email}`);
router.replace('/');
} }
} else { } else {

View File

@@ -84,7 +84,7 @@ export default function Account() {
</Link> </Link>
{/*Tak dodałem, można zmienić na coś innego*/} {/*Tak dodałem, można zmienić na coś innego*/}
<Link href="/dashboard/userPaymentHistory" asChild> <Link href="/dashboard/userOrders" asChild>
<Pressable className="py-3 flex-row items-center border-b border-gray-100"> <Pressable className="py-3 flex-row items-center border-b border-gray-100">
<Text className="text-lg flex-1">Historia płatności</Text> <Text className="text-lg flex-1">Historia płatności</Text>
<Text></Text> <Text></Text>

View File

@@ -1,31 +1,31 @@
import { Stack, Redirect } from "expo-router"; import {Stack} from "expo-router";
import "@/global.css"; import "@/global.css";
import { GluestackUIProvider } from "@/components/ui/gluestack-ui-provider"; import {GluestackUIProvider} from "@/components/ui/gluestack-ui-provider";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
const queryClient = new QueryClient(); const queryClient = new QueryClient();
export default function RootLayout() { export default function RootLayout() {
return ( return (
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<GluestackUIProvider> <GluestackUIProvider>
<Stack <Stack
screenOptions={{ screenOptions={{
headerTintColor: "#1c1c1e", headerTintColor: "#1c1c1e",
headerBackTitleVisible: false, headerBackTitleVisible: false,
headerBackTitle: "Wróć", headerBackTitle: "Wróć",
}} }}
> >
<Stack.Screen name="(tabs)" options={{ headerShown: false }} /> <Stack.Screen name="(tabs)" options={{headerShown: false}}/>
<Stack.Screen name="user" options={{ headerShown: false }} /> {/*<Stack.Screen name="user" options={{headerShown: false}}/>*/}
<Stack.Screen <Stack.Screen
name="(auth)/login" name="(auth)/login"
options={{ headerShown: false }}/> options={{headerShown: false}}/>
<Stack.Screen <Stack.Screen
name="registration" name="registration"
options={{ headerShown: false }}/> options={{headerShown: false}}/>
</Stack> </Stack>
</GluestackUIProvider> </GluestackUIProvider>
</QueryClientProvider> </QueryClientProvider>
); );
} }

View File

@@ -49,6 +49,8 @@ export default function NoticeDetails() {
const [Email, setEmail] = useState(""); const [Email, setEmail] = useState("");
const [isSending, setIsSending] = useState(false); const [isSending, setIsSending] = useState(false);
const {width} = Dimensions.get("window");
const handleSendMessage = async () => { const handleSendMessage = async () => {
setIsSending(true); setIsSending(true);
console.log("Rozpoczynanie procesu wysyłania wiadomości..."); console.log("Rozpoczynanie procesu wysyłania wiadomości...");
@@ -303,6 +305,7 @@ export default function NoticeDetails() {
data={images} data={images}
horizontal horizontal
snapToAlignment="start" snapToAlignment="start"
snapToInterval={width}
decelerationRate="fast" decelerationRate="fast"
showsHorizontalScrollIndicator={false} showsHorizontalScrollIndicator={false}
pagingEnabled pagingEnabled
@@ -311,13 +314,14 @@ export default function NoticeDetails() {
style={isLandscape ? { flex: 1 } : {}} style={isLandscape ? { flex: 1 } : {}}
renderItem={({ item, index }) => ( renderItem={({ item, index }) => (
<View <View
style={{ width: Dimensions.get("window").width }} style={{ width: width }}
className="p-1" className="p-1"
> >
<Image <Image
source={item} source={item}
// className="h-auto w-auto rounded-md aspect-[1/1]" // className="h-auto w-auto rounded-md aspect-[1/1]"
alt={`Zdjęcie ${index + 1}`} alt={`Zdjęcie ${index + 1}`}
resizeMode="cover"
renderMode="contain" renderMode="contain"
className={ className={
isLandscape isLandscape