get discrit token
This commit is contained in:
@@ -109,12 +109,12 @@ export const auth_api = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async get_district(): Promise<AxiosResponse<GetDistrict[]>> {
|
async get_district(body: { token: string, tokenName: string }): Promise<AxiosResponse<GetDistrict[]>> {
|
||||||
try {
|
try {
|
||||||
const res = await axios.get(`https://testapi3.didox.uz/v1/districts/all/`, {
|
const res = await axios.get(`https://testapi3.didox.uz/v1/districts/all/`, {
|
||||||
headers: {
|
headers: {
|
||||||
"Accept-Language": "uz",
|
"Accept-Language": "uz",
|
||||||
"Partner-Authorization": `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MzYsInN0YXR1cyI6IkFDVElWRSIsIm5hbWUiOiJcIkZFTElYIC0gSVRTXCIgTUNISiIsInJvbGUiOiJQQVJUTkVSIiwidGluIjoiMzA3NTA0MzQ4IiwiaWF0IjoxNzczMzkyMjcwfQ.Q-cIBl4Z784Fq5jdRUEVYF2iaUd7_5RD2sFsJeh-Xno `
|
[body.tokenName]: body.token
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
@@ -123,12 +123,12 @@ export const auth_api = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async get_region(): Promise<AxiosResponse<GetRegion[]>> {
|
async get_region(body: { token: string, tokenName: string }): Promise<AxiosResponse<GetRegion[]>> {
|
||||||
try {
|
try {
|
||||||
const res = await axios.get(`https://testapi3.didox.uz/v1/regions/all/`, {
|
const res = await axios.get(`https://testapi3.didox.uz/v1/regions/all/`, {
|
||||||
headers: {
|
headers: {
|
||||||
"Accept-Language": "uz",
|
"Accept-Language": "uz",
|
||||||
"Partner-Authorization": `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MzYsInN0YXR1cyI6IkFDVElWRSIsIm5hbWUiOiJcIkZFTElYIC0gSVRTXCIgTUNISiIsInJvbGUiOiJQQVJUTkVSIiwidGluIjoiMzA3NTA0MzQ4IiwiaWF0IjoxNzczMzkyMjcwfQ.Q-cIBl4Z784Fq5jdRUEVYF2iaUd7_5RD2sFsJeh-Xno `
|
[body.tokenName]: body.token
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -94,12 +94,14 @@ export default function RegisterFormScreen() {
|
|||||||
|
|
||||||
const { data: districts } = useQuery({
|
const { data: districts } = useQuery({
|
||||||
queryKey: ["discrit"],
|
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({
|
const { data: regions } = useQuery({
|
||||||
queryKey: ["regions"],
|
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({
|
const { data: countryResponse, isLoading: countryLoading } = useQuery({
|
||||||
|
|||||||
Reference in New Issue
Block a user