UNPKG

mychips-react-sdk

Version:
30 lines (22 loc) 743 B
import AsyncStorage from '@react-native-async-storage/async-storage'; export class RateLimitService { private static storageKey: string = 'enable_requests'; // Method to enable making requests public static async enableRequest(): Promise<void> { try { await AsyncStorage.setItem(this.storageKey, "true"); } catch (error) { console.error('Failed to enable request', error); } } // Method to check if a request can be made public static async canMakeRequest(): Promise<boolean> { try { const value = await AsyncStorage.getItem(this.storageKey); return value === "true"; } catch (error) { console.error('Failed to get request status', error); return false; } } }