From fee9213c59f459df86c6615b66a60ae8dc0b8398 Mon Sep 17 00:00:00 2001 From: Samandar Turgunboyev Date: Thu, 19 Mar 2026 14:04:41 +0500 Subject: [PATCH] get discrit token --- screens/auth/login/lib/api.ts | 8 ++++---- screens/auth/register/RegisterForm.tsx | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/screens/auth/login/lib/api.ts b/screens/auth/login/lib/api.ts index 23bc0a3..136951a 100644 --- a/screens/auth/login/lib/api.ts +++ b/screens/auth/login/lib/api.ts @@ -109,12 +109,12 @@ export const auth_api = { } }, - async get_district(): Promise> { + async get_district(body: { token: string, tokenName: string }): Promise> { try { const res = await axios.get(`https://testapi3.didox.uz/v1/districts/all/`, { headers: { "Accept-Language": "uz", - "Partner-Authorization": `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MzYsInN0YXR1cyI6IkFDVElWRSIsIm5hbWUiOiJcIkZFTElYIC0gSVRTXCIgTUNISiIsInJvbGUiOiJQQVJUTkVSIiwidGluIjoiMzA3NTA0MzQ4IiwiaWF0IjoxNzczMzkyMjcwfQ.Q-cIBl4Z784Fq5jdRUEVYF2iaUd7_5RD2sFsJeh-Xno ` + [body.tokenName]: body.token } }); return res; @@ -123,12 +123,12 @@ export const auth_api = { } }, - async get_region(): Promise> { + async get_region(body: { token: string, tokenName: string }): Promise> { try { const res = await axios.get(`https://testapi3.didox.uz/v1/regions/all/`, { headers: { "Accept-Language": "uz", - "Partner-Authorization": `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MzYsInN0YXR1cyI6IkFDVElWRSIsIm5hbWUiOiJcIkZFTElYIC0gSVRTXCIgTUNISiIsInJvbGUiOiJQQVJUTkVSIiwidGluIjoiMzA3NTA0MzQ4IiwiaWF0IjoxNzczMzkyMjcwfQ.Q-cIBl4Z784Fq5jdRUEVYF2iaUd7_5RD2sFsJeh-Xno ` + [body.tokenName]: body.token } }); return res; diff --git a/screens/auth/register/RegisterForm.tsx b/screens/auth/register/RegisterForm.tsx index 120cfad..8c20e80 100644 --- a/screens/auth/register/RegisterForm.tsx +++ b/screens/auth/register/RegisterForm.tsx @@ -94,12 +94,14 @@ export default function RegisterFormScreen() { const { data: districts } = useQuery({ queryKey: ["discrit"], - queryFn: async () => auth_api.get_district(), + queryFn: async () => auth_api.get_district({ token: token?.value || "", tokenName: token?.name || "" }), + enabled: !!token, }) const { data: regions } = useQuery({ queryKey: ["regions"], - queryFn: async () => auth_api.get_region(), + queryFn: async () => auth_api.get_region({ token: token?.value || "", tokenName: token?.name || "" }), + enabled: !!token, }) const { data: countryResponse, isLoading: countryLoading } = useQuery({