mirror of
https://github.com/koel/koel
synced 2025-01-12 12:48:44 +00:00
22 lines
362 B
TypeScript
22 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)
|
||
|
}
|
||
|
}
|