mirror of
https://github.com/koel/koel
synced 2024-12-25 03:53:05 +00:00
21 lines
362 B
TypeScript
21 lines
362 B
TypeScript
import { ls } from '.'
|
|
|
|
export const auth = {
|
|
storageKey: 'api-token',
|
|
|
|
getToken (): string | null {
|
|
return ls.get<string | null>(this.storageKey)
|
|
},
|
|
|
|
hasToken (): boolean {
|
|
return Boolean(this.getToken())
|
|
},
|
|
|
|
setToken (token: string): void {
|
|
ls.set(this.storageKey, token)
|
|
},
|
|
|
|
destroy (): void {
|
|
ls.remove(this.storageKey)
|
|
}
|
|
}
|