mirror of
https://github.com/koel/koel
synced 2024-11-24 21:23: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)
|
|
}
|