diff --git a/src/api/auth.ts b/src/api/auth.ts new file mode 100644 index 00000000..c72b6823 --- /dev/null +++ b/src/api/auth.ts @@ -0,0 +1,24 @@ +import axios from 'axios'; +import type { Auth, Logout, Update } from '#/auth'; + +export const apiAuth = { + async login() { + const { data } = await axios.post('api/v1/auth/login'); + return data; + }, + + async refresh() { + const { data } = await axios.get('api/v1/auth/refresh_token'); + return data; + }, + + async logout() { + const { data } = await axios.get('api/v1/auth/logout'); + return data; + }, + + async update() { + const { data } = await axios.post('api/v1/auth/update'); + return data; + }, +}; diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts index 0a4f2a17..df9eb747 100644 --- a/src/auto-imports.d.ts +++ b/src/auto-imports.d.ts @@ -5,6 +5,7 @@ declare global { const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate'] const afterAll: typeof import('vitest')['afterAll'] const afterEach: typeof import('vitest')['afterEach'] + const apiAuth: typeof import('./api/auth')['apiAuth'] const apiBangumi: typeof import('./api/bangumi')['apiBangumi'] const apiCheck: typeof import('./api/check')['apiCheck'] const apiConfig: typeof import('./api/config')['apiConfig'] diff --git a/src/basic/ab-select.vue b/src/basic/ab-select.vue index a387794b..27734607 100644 --- a/src/basic/ab-select.vue +++ b/src/basic/ab-select.vue @@ -11,7 +11,7 @@ import { isObject, isString } from 'lodash'; const props = withDefaults( defineProps<{ - modelValue?: SelectItem; + modelValue?: SelectItem | string; items: Array; }>(), {} diff --git a/src/components.d.ts b/src/components.d.ts index a506e43d..18bdd69a 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -28,8 +28,14 @@ declare module '@vue/runtime-core' { AbSwitch: typeof import('./basic/ab-switch.vue')['default'] AbTopbar: typeof import('./views/ab-topbar.vue')['default'] BangumiCard: typeof import('./components/bangumi-card.vue')['default'] + ConfigDownload: typeof import('./views/config-download.vue')['default'] + ConfigManage: typeof import('./views/config-manage.vue')['default'] + ConfigManager: typeof import('./views/config-manager.vue')['default'] ConfigNormal: typeof import('./views/config-normal.vue')['default'] + ConfigNotification: typeof import('./views/config-notification.vue')['default'] + ConfigNotificcation: typeof import('./views/config-notificcation.vue')['default'] ConfigParser: typeof import('./views/config-parser.vue')['default'] + ConfigProxy: typeof import('./views/config-proxy.vue')['default'] copy: typeof import('./basic/ab-switch copy.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/src/components/ab-fold-panel.vue b/src/components/ab-fold-panel.vue index 646d7bd7..2ca82197 100644 --- a/src/components/ab-fold-panel.vue +++ b/src/components/ab-fold-panel.vue @@ -14,7 +14,7 @@ const props = withDefaults(