abckit 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +0,0 @@
1
- import { Capacitor } from "@capacitor/core";
2
- import { Preferences } from "@capacitor/preferences";
3
- import { registerCapacitorHandlers, useAuth } from "./useAuth.js";
4
- const AUTH_TOKEN_KEY = "auth_token";
5
- export function useAuthMobile() {
6
- if (!Capacitor.isNativePlatform()) {
7
- return useAuth();
8
- }
9
- registerCapacitorHandlers({
10
- onSuccess: async (authToken) => {
11
- await Preferences.set({ key: AUTH_TOKEN_KEY, value: authToken });
12
- },
13
- getToken: async () => {
14
- const result = await Preferences.get({ key: AUTH_TOKEN_KEY });
15
- return result?.value || "";
16
- },
17
- clearToken: async () => {
18
- await Preferences.remove({ key: AUTH_TOKEN_KEY });
19
- }
20
- });
21
- return useAuth();
22
- }
23
- export { Capacitor, Preferences };