mirror of
https://github.com/koel/koel
synced 2024-12-24 19:43:06 +00:00
14 lines
377 B
TypeScript
14 lines
377 B
TypeScript
import { localStorageService } from '@/services'
|
|
|
|
const STORAGE_KEY = 'api-token'
|
|
|
|
export const authService = {
|
|
getToken: () => localStorageService.get<string | null>(STORAGE_KEY),
|
|
|
|
hasToken () {
|
|
return Boolean(this.getToken())
|
|
},
|
|
|
|
setToken: (token: string) => localStorageService.set(STORAGE_KEY, token),
|
|
destroy: () => localStorageService.remove(STORAGE_KEY)
|
|
}
|