Created
December 15, 2019 16:12
-
-
Save indatawetrust/780d01b5b02af17e0e381c3e7e7cc75a to your computer and use it in GitHub Desktop.
capacitor auth storage for featherjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Plugins } from "@capacitor/core"; | |
const { Storage } = Plugins; | |
export default class CapacitorStorage { | |
static async getItem(key: string) { | |
const { value } = (await Storage.get({ key })) || { value: null }; | |
return value; | |
} | |
static setItem(key: string, value: any) { | |
return Storage.set({ | |
key, | |
value | |
}); | |
} | |
static removeItem(key: string) { | |
return Storage.remove({ key }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment