Update layout and localization for improved functionality

- Added AsyncStorage and utility functions for future enhancements.
- Commented out ServicesGrid component in HomeScreen for potential redesign.
- Updated English and Russian localization files with new phrases and translations for prayer times and services.
This commit is contained in:
2025-09-01 18:34:22 +05:00
parent f519052b7b
commit 3d9b8601bf
6 changed files with 86 additions and 3 deletions

35
utils/makeRequest.ts Normal file
View File

@@ -0,0 +1,35 @@
import { BASE_URL } from './api';
export const makeRequest = async <T,>(
endpoint: string,
options?: RequestInit
): Promise<T> => {
const url = new URL(endpoint, BASE_URL).toString();
try {
const response = await fetch(url, options);
console.log(response);
if (!response.ok) {
let errorData;
try {
errorData = await response.json();
} catch (e) {
// Ignore JSON parsing errors if the body is empty
}
const errorMessage =
errorData?.message ||
`Request failed with status ${response.status}`;
throw new Error(errorMessage);
}
if (response.status === 204) {
return null as T;
}
return response.json();
} catch (error) {
console.error('API request error:', error);
throw error;
}
};