making login work for prod
This commit is contained in:
15
src/util.js
15
src/util.js
@@ -1,4 +1,19 @@
|
||||
import { Preferences } from '@capacitor/preferences';
|
||||
|
||||
export default class util {
|
||||
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 cssVariable(value) {
|
||||
return getComputedStyle(document.documentElement)
|
||||
.getPropertyValue("--" + value)
|
||||
|
||||
Reference in New Issue
Block a user