import { Preferences } from '@capacitor/preferences'; const env = import.meta.env export default class util { static HOST = env.VITE_API_URL static async authFetch(url, options = {}) { const { value: token } = await Preferences.get({ key: 'auth_token' }); return fetch(url, { ...options, headers: { ...options.headers, 'Authorization': `Bearer ${token}`, 'X-Client': 'mobile' } }); } static async removeAuthToken() { await Preferences.remove({ key: 'auth_token'}) } static cssVariable(value) { return getComputedStyle(document.documentElement) .getPropertyValue("--" + value) .trim(); } }