From d44124429c636179874361e6637ebd4b9fe3b393 Mon Sep 17 00:00:00 2001 From: Twilight Date: Tue, 19 Mar 2024 16:35:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E5=89=8D=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 12 +- openapitools.json | 7 + package.json | 5 + postcss.config.js | 6 + src/App.vue | 82 +-- src/assets/base.css | 86 --- src/assets/main.css | 40 +- src/components/Front.vue | 31 ++ src/components/HelloWorld.vue | 41 -- src/components/Layout.vue | 26 + src/components/TheWelcome.vue | 88 --- src/components/WelcomeItem.vue | 87 --- src/components/icons/IconCommunity.vue | 7 - src/components/icons/IconDocumentation.vue | 7 - src/components/icons/IconEcosystem.vue | 7 - src/components/icons/IconSupport.vue | 7 - src/components/icons/IconTooling.vue | 19 - src/config/config.ts | 13 + src/config/keycloak.ts | 10 + src/main.ts | 10 +- src/openapi/.gitignore | 4 + src/openapi/.npmignore | 1 + src/openapi/.openapi-generator-ignore | 23 + src/openapi/.openapi-generator/FILES | 9 + src/openapi/.openapi-generator/VERSION | 1 + src/openapi/api.ts | 604 +++++++++++++++++++++ src/openapi/base.ts | 86 +++ src/openapi/common.ts | 150 +++++ src/openapi/configuration.ts | 110 ++++ src/openapi/git_push.sh | 57 ++ src/openapi/index.ts | 18 + src/plugins/backend.ts | 16 + src/plugins/registerPlugins.ts | 10 + src/router/index.ts | 10 +- src/stores/index.ts | 7 + src/stores/user.ts | 18 +- src/views/AboutView.vue | 15 - src/views/Home.vue | 11 + src/views/HomeView.vue | 9 - src/views/auth/Login.vue | 47 +- tailwind.config.js | 10 + yarn.lock | 592 +++++++++++++++++++- 42 files changed, 1863 insertions(+), 536 deletions(-) create mode 100644 openapitools.json create mode 100644 postcss.config.js delete mode 100644 src/assets/base.css create mode 100644 src/components/Front.vue delete mode 100644 src/components/HelloWorld.vue create mode 100644 src/components/Layout.vue delete mode 100644 src/components/TheWelcome.vue delete mode 100644 src/components/WelcomeItem.vue delete mode 100644 src/components/icons/IconCommunity.vue delete mode 100644 src/components/icons/IconDocumentation.vue delete mode 100644 src/components/icons/IconEcosystem.vue delete mode 100644 src/components/icons/IconSupport.vue delete mode 100644 src/components/icons/IconTooling.vue create mode 100644 src/config/config.ts create mode 100644 src/config/keycloak.ts create mode 100644 src/openapi/.gitignore create mode 100644 src/openapi/.npmignore create mode 100644 src/openapi/.openapi-generator-ignore create mode 100644 src/openapi/.openapi-generator/FILES create mode 100644 src/openapi/.openapi-generator/VERSION create mode 100644 src/openapi/api.ts create mode 100644 src/openapi/base.ts create mode 100644 src/openapi/common.ts create mode 100644 src/openapi/configuration.ts create mode 100644 src/openapi/git_push.sh create mode 100644 src/openapi/index.ts create mode 100644 src/plugins/backend.ts create mode 100644 src/plugins/registerPlugins.ts create mode 100644 src/stores/index.ts delete mode 100644 src/views/AboutView.vue create mode 100644 src/views/Home.vue delete mode 100644 src/views/HomeView.vue create mode 100644 tailwind.config.js diff --git a/index.html b/index.html index a888544..d9db8b4 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,13 @@ - + Vite App - - -
- - + + +
+ + diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 0000000..5571688 --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.4.0" + } +} diff --git a/package.json b/package.json index a972a03..e9d6e34 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,14 @@ "format": "prettier --write src/" }, "dependencies": { + "autoprefixer": "^10.4.18", + "axios": "^1.6.8", "keycloak-js": "^24.0.1", "naive-ui": "^2.38.1", "pinia": "^2.1.7", + "pinia-plugin-persistedstate": "^3.2.1", + "postcss": "^8.4.36", + "tailwindcss": "^3.4.1", "vue": "^3.4.21", "vue-router": "^4.3.0" }, diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..2e7af2b --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/src/App.vue b/src/App.vue index 7905b05..f0b8305 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,85 +1,9 @@ - - diff --git a/src/assets/base.css b/src/assets/base.css deleted file mode 100644 index 8816868..0000000 --- a/src/assets/base.css +++ /dev/null @@ -1,86 +0,0 @@ -/* color palette from */ -:root { - --vt-c-white: #ffffff; - --vt-c-white-soft: #f8f8f8; - --vt-c-white-mute: #f2f2f2; - - --vt-c-black: #181818; - --vt-c-black-soft: #222222; - --vt-c-black-mute: #282828; - - --vt-c-indigo: #2c3e50; - - --vt-c-divider-light-1: rgba(60, 60, 60, 0.29); - --vt-c-divider-light-2: rgba(60, 60, 60, 0.12); - --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65); - --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48); - - --vt-c-text-light-1: var(--vt-c-indigo); - --vt-c-text-light-2: rgba(60, 60, 60, 0.66); - --vt-c-text-dark-1: var(--vt-c-white); - --vt-c-text-dark-2: rgba(235, 235, 235, 0.64); -} - -/* semantic color variables for this project */ -:root { - --color-background: var(--vt-c-white); - --color-background-soft: var(--vt-c-white-soft); - --color-background-mute: var(--vt-c-white-mute); - - --color-border: var(--vt-c-divider-light-2); - --color-border-hover: var(--vt-c-divider-light-1); - - --color-heading: var(--vt-c-text-light-1); - --color-text: var(--vt-c-text-light-1); - - --section-gap: 160px; -} - -@media (prefers-color-scheme: dark) { - :root { - --color-background: var(--vt-c-black); - --color-background-soft: var(--vt-c-black-soft); - --color-background-mute: var(--vt-c-black-mute); - - --color-border: var(--vt-c-divider-dark-2); - --color-border-hover: var(--vt-c-divider-dark-1); - - --color-heading: var(--vt-c-text-dark-1); - --color-text: var(--vt-c-text-dark-2); - } -} - -*, -*::before, -*::after { - box-sizing: border-box; - margin: 0; - font-weight: normal; -} - -body { - min-height: 100vh; - color: var(--color-text); - background: var(--color-background); - transition: - color 0.5s, - background-color 0.5s; - line-height: 1.6; - font-family: - Inter, - -apple-system, - BlinkMacSystemFont, - 'Segoe UI', - Roboto, - Oxygen, - Ubuntu, - Cantarell, - 'Fira Sans', - 'Droid Sans', - 'Helvetica Neue', - sans-serif; - font-size: 15px; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} diff --git a/src/assets/main.css b/src/assets/main.css index 36fb845..c9aef9b 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -1,35 +1,7 @@ -@import './base.css'; +@tailwind base; +@tailwind components; +@tailwind utilities; -#app { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - font-weight: normal; -} - -a, -.green { - text-decoration: none; - color: hsla(160, 100%, 37%, 1); - transition: 0.4s; - padding: 3px; -} - -@media (hover: hover) { - a:hover { - background-color: hsla(160, 100%, 37%, 0.2); - } -} - -@media (min-width: 1024px) { - body { - display: flex; - place-items: center; - } - - #app { - display: grid; - grid-template-columns: 1fr 1fr; - padding: 0 2rem; - } -} +body { + text-rendering: optimizeLegibility; +} \ No newline at end of file diff --git a/src/components/Front.vue b/src/components/Front.vue new file mode 100644 index 0000000..b396c14 --- /dev/null +++ b/src/components/Front.vue @@ -0,0 +1,31 @@ + + + + diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue deleted file mode 100644 index 38d821e..0000000 --- a/src/components/HelloWorld.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/src/components/Layout.vue b/src/components/Layout.vue new file mode 100644 index 0000000..72a8682 --- /dev/null +++ b/src/components/Layout.vue @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file diff --git a/src/components/TheWelcome.vue b/src/components/TheWelcome.vue deleted file mode 100644 index 49d8f73..0000000 --- a/src/components/TheWelcome.vue +++ /dev/null @@ -1,88 +0,0 @@ - - - diff --git a/src/components/WelcomeItem.vue b/src/components/WelcomeItem.vue deleted file mode 100644 index 6d7086a..0000000 --- a/src/components/WelcomeItem.vue +++ /dev/null @@ -1,87 +0,0 @@ - - - diff --git a/src/components/icons/IconCommunity.vue b/src/components/icons/IconCommunity.vue deleted file mode 100644 index 2dc8b05..0000000 --- a/src/components/icons/IconCommunity.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/src/components/icons/IconDocumentation.vue b/src/components/icons/IconDocumentation.vue deleted file mode 100644 index 6d4791c..0000000 --- a/src/components/icons/IconDocumentation.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/src/components/icons/IconEcosystem.vue b/src/components/icons/IconEcosystem.vue deleted file mode 100644 index c3a4f07..0000000 --- a/src/components/icons/IconEcosystem.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/src/components/icons/IconSupport.vue b/src/components/icons/IconSupport.vue deleted file mode 100644 index 7452834..0000000 --- a/src/components/icons/IconSupport.vue +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/src/components/icons/IconTooling.vue b/src/components/icons/IconTooling.vue deleted file mode 100644 index 660598d..0000000 --- a/src/components/icons/IconTooling.vue +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/src/config/config.ts b/src/config/config.ts new file mode 100644 index 0000000..3bcdf58 --- /dev/null +++ b/src/config/config.ts @@ -0,0 +1,13 @@ +let config = { + auth: { + server: "https://kc.ivampiresp.com", + clientId: "dev", + realm: "test", + scopes: "openid email profile", + }, + api: { + baseUrl: "http://127.0.0.1:8081", + } +} + +export default config \ No newline at end of file diff --git a/src/config/keycloak.ts b/src/config/keycloak.ts new file mode 100644 index 0000000..6b44073 --- /dev/null +++ b/src/config/keycloak.ts @@ -0,0 +1,10 @@ +import Keycloak from "keycloak-js"; +import config from "@/config/config"; + +let keycloak = new Keycloak({ + url: config.auth.server, + realm: config.auth.realm, + clientId: config.auth.clientId, +}) + +export default keycloak \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 5dcad83..8393f50 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,14 +1,16 @@ import './assets/main.css' import { createApp } from 'vue' -import { createPinia } from 'pinia' import App from './App.vue' -import router from './router' +import {registerPlugins} from "@/plugins/registerPlugins"; const app = createApp(App) -app.use(createPinia()) -app.use(router) +registerPlugins(app) + +const meta = document.createElement('meta') +meta.name = 'naive-ui-style' +document.head.appendChild(meta) app.mount('#app') diff --git a/src/openapi/.gitignore b/src/openapi/.gitignore new file mode 100644 index 0000000..149b576 --- /dev/null +++ b/src/openapi/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/src/openapi/.npmignore b/src/openapi/.npmignore new file mode 100644 index 0000000..999d88d --- /dev/null +++ b/src/openapi/.npmignore @@ -0,0 +1 @@ +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/src/openapi/.openapi-generator-ignore b/src/openapi/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/src/openapi/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/src/openapi/.openapi-generator/FILES b/src/openapi/.openapi-generator/FILES new file mode 100644 index 0000000..16b445e --- /dev/null +++ b/src/openapi/.openapi-generator/FILES @@ -0,0 +1,9 @@ +.gitignore +.npmignore +.openapi-generator-ignore +api.ts +base.ts +common.ts +configuration.ts +git_push.sh +index.ts diff --git a/src/openapi/.openapi-generator/VERSION b/src/openapi/.openapi-generator/VERSION new file mode 100644 index 0000000..ba7f754 --- /dev/null +++ b/src/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.4.0 diff --git a/src/openapi/api.ts b/src/openapi/api.ts new file mode 100644 index 0000000..81d6ab7 --- /dev/null +++ b/src/openapi/api.ts @@ -0,0 +1,604 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * MC Search API + * MC Search API 服务 + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base'; + +/** + * + * @export + * @interface ControllerAllSpidersResponse + */ +export interface ControllerAllSpidersResponse { + /** + * + * @type {Array} + * @memberof ControllerAllSpidersResponse + */ + 'Spiders'?: Array; +} +/** + * + * @export + * @interface ControllerCreateSpiderRequest + */ +export interface ControllerCreateSpiderRequest { + /** + * + * @type {string} + * @memberof ControllerCreateSpiderRequest + */ + 'name': string; +} +/** + * + * @export + * @interface ControllerGetSpiderResponse + */ +export interface ControllerGetSpiderResponse { + /** + * + * @type {ModelSpiderPublic} + * @memberof ControllerGetSpiderResponse + */ + 'spider'?: ModelSpiderPublic; +} +/** + * + * @export + * @interface ControllerSpiderPushLinkRequest + */ +export interface ControllerSpiderPushLinkRequest { + /** + * + * @type {string} + * @memberof ControllerSpiderPushLinkRequest + */ + 'LastModify'?: string; + /** + * + * @type {string} + * @memberof ControllerSpiderPushLinkRequest + */ + 'Url'?: string; +} +/** + * + * @export + * @interface ModelPendingLink + */ +export interface ModelPendingLink { + /** + * + * @type {string} + * @memberof ModelPendingLink + */ + 'CreatedAt'?: string; + /** + * + * @type {string} + * @memberof ModelPendingLink + */ + 'DeletedAt'?: string; + /** + * + * @type {string} + * @memberof ModelPendingLink + */ + 'FailedReason'?: string; + /** + * + * @type {number} + * @memberof ModelPendingLink + */ + 'Id'?: number; + /** + * UserId uint `xorm:\"unsigned\"` + * @type {string} + * @memberof ModelPendingLink + */ + 'LastModify'?: string; + /** + * + * @type {number} + * @memberof ModelPendingLink + */ + 'Retries'?: number; + /** + * + * @type {number} + * @memberof ModelPendingLink + */ + 'SpiderId'?: number; + /** + * + * @type {number} + * @memberof ModelPendingLink + */ + 'StatusCode'?: number; + /** + * + * @type {string} + * @memberof ModelPendingLink + */ + 'UpdatedAt'?: string; + /** + * + * @type {string} + * @memberof ModelPendingLink + */ + 'Url'?: string; + /** + * + * @type {string} + * @memberof ModelPendingLink + */ + 'UrlHash'?: string; +} +/** + * + * @export + * @interface ModelSpiderPublic + */ +export interface ModelSpiderPublic { + /** + * + * @type {string} + * @memberof ModelSpiderPublic + */ + 'CreatedAt'?: string; + /** + * + * @type {string} + * @memberof ModelSpiderPublic + */ + 'DeletedAt'?: string; + /** + * + * @type {number} + * @memberof ModelSpiderPublic + */ + 'Id'?: number; + /** + * + * @type {string} + * @memberof ModelSpiderPublic + */ + 'Ip'?: string; + /** + * + * @type {string} + * @memberof ModelSpiderPublic + */ + 'Name'?: string; + /** + * + * @type {string} + * @memberof ModelSpiderPublic + */ + 'Status'?: string; + /** + * + * @type {string} + * @memberof ModelSpiderPublic + */ + 'UpdatedAt'?: string; + /** + * + * @type {number} + * @memberof ModelSpiderPublic + */ + 'UserId'?: number; +} + +/** + * SpiderApi - axios parameter creator + * @export + */ +export const SpiderApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary 查看指定的蜘蛛(仅能当前账户) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSpidersGet: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/spiders`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary 获取蜘蛛的 Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSpidersIdTokenGet: async (id: number, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('apiSpidersIdTokenGet', 'id', id) + const localVarPath = `/api/spiders/:Id/token`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + if (id !== undefined) { + localVarQueryParameter['Id'] = id; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary 创建一个蜘蛛 + * @param {ControllerCreateSpiderRequest} payload 创建蜘蛛 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSpidersPost: async (payload: ControllerCreateSpiderRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'payload' is not null or undefined + assertParamExists('apiSpidersPost', 'payload', payload) + const localVarPath = `/api/spiders`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(payload, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary 获取下一个链接 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + devicesSpidersLinksGet: async (options: RawAxiosRequestConfig = {}): Promise => { + const localVarPath = `/devices/spiders/links`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerTokenSpider required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * 爬虫探测到链接后,将提交链接。 + * @summary 爬虫提交链接 + * @param {ControllerSpiderPushLinkRequest} payload 爬虫提交链接 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + devicesSpidersLinksPost: async (payload: ControllerSpiderPushLinkRequest, options: RawAxiosRequestConfig = {}): Promise => { + // verify required parameter 'payload' is not null or undefined + assertParamExists('devicesSpidersLinksPost', 'payload', payload) + const localVarPath = `/devices/spiders/links`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerTokenSpider required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(payload, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * SpiderApi - functional programming interface + * @export + */ +export const SpiderApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = SpiderApiAxiosParamCreator(configuration) + return { + /** + * + * @summary 查看指定的蜘蛛(仅能当前账户) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSpidersGet(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiSpidersGet(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['SpiderApi.apiSpidersGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 获取蜘蛛的 Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSpidersIdTokenGet(id: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiSpidersIdTokenGet(id, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['SpiderApi.apiSpidersIdTokenGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 创建一个蜘蛛 + * @param {ControllerCreateSpiderRequest} payload 创建蜘蛛 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSpidersPost(payload: ControllerCreateSpiderRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.apiSpidersPost(payload, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['SpiderApi.apiSpidersPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * + * @summary 获取下一个链接 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async devicesSpidersLinksGet(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.devicesSpidersLinksGet(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['SpiderApi.devicesSpidersLinksGet']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + /** + * 爬虫探测到链接后,将提交链接。 + * @summary 爬虫提交链接 + * @param {ControllerSpiderPushLinkRequest} payload 爬虫提交链接 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async devicesSpidersLinksPost(payload: ControllerSpiderPushLinkRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.devicesSpidersLinksPost(payload, options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = operationServerMap['SpiderApi.devicesSpidersLinksPost']?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); + }, + } +}; + +/** + * SpiderApi - factory interface + * @export + */ +export const SpiderApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = SpiderApiFp(configuration) + return { + /** + * + * @summary 查看指定的蜘蛛(仅能当前账户) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSpidersGet(options?: any): AxiosPromise { + return localVarFp.apiSpidersGet(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 获取蜘蛛的 Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSpidersIdTokenGet(id: number, options?: any): AxiosPromise { + return localVarFp.apiSpidersIdTokenGet(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 创建一个蜘蛛 + * @param {ControllerCreateSpiderRequest} payload 创建蜘蛛 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSpidersPost(payload: ControllerCreateSpiderRequest, options?: any): AxiosPromise { + return localVarFp.apiSpidersPost(payload, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 获取下一个链接 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + devicesSpidersLinksGet(options?: any): AxiosPromise { + return localVarFp.devicesSpidersLinksGet(options).then((request) => request(axios, basePath)); + }, + /** + * 爬虫探测到链接后,将提交链接。 + * @summary 爬虫提交链接 + * @param {ControllerSpiderPushLinkRequest} payload 爬虫提交链接 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + devicesSpidersLinksPost(payload: ControllerSpiderPushLinkRequest, options?: any): AxiosPromise { + return localVarFp.devicesSpidersLinksPost(payload, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * SpiderApi - object-oriented interface + * @export + * @class SpiderApi + * @extends {BaseAPI} + */ +export class SpiderApi extends BaseAPI { + /** + * + * @summary 查看指定的蜘蛛(仅能当前账户) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SpiderApi + */ + public apiSpidersGet(options?: RawAxiosRequestConfig) { + return SpiderApiFp(this.configuration).apiSpidersGet(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 获取蜘蛛的 Token + * @param {number} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SpiderApi + */ + public apiSpidersIdTokenGet(id: number, options?: RawAxiosRequestConfig) { + return SpiderApiFp(this.configuration).apiSpidersIdTokenGet(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 创建一个蜘蛛 + * @param {ControllerCreateSpiderRequest} payload 创建蜘蛛 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SpiderApi + */ + public apiSpidersPost(payload: ControllerCreateSpiderRequest, options?: RawAxiosRequestConfig) { + return SpiderApiFp(this.configuration).apiSpidersPost(payload, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary 获取下一个链接 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SpiderApi + */ + public devicesSpidersLinksGet(options?: RawAxiosRequestConfig) { + return SpiderApiFp(this.configuration).devicesSpidersLinksGet(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * 爬虫探测到链接后,将提交链接。 + * @summary 爬虫提交链接 + * @param {ControllerSpiderPushLinkRequest} payload 爬虫提交链接 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SpiderApi + */ + public devicesSpidersLinksPost(payload: ControllerSpiderPushLinkRequest, options?: RawAxiosRequestConfig) { + return SpiderApiFp(this.configuration).devicesSpidersLinksPost(payload, options).then((request) => request(this.axios, this.basePath)); + } +} + + + diff --git a/src/openapi/base.ts b/src/openapi/base.ts new file mode 100644 index 0000000..8bf5fc4 --- /dev/null +++ b/src/openapi/base.ts @@ -0,0 +1,86 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * MC Search API + * MC Search API 服务 + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; + +export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: RawAxiosRequestConfig; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath ?? basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + constructor(public field: string, msg?: string) { + super(msg); + this.name = "RequiredError" + } +} + +interface ServerMap { + [key: string]: { + url: string, + description: string, + }[]; +} + +/** + * + * @export + */ +export const operationServerMap: ServerMap = { +} diff --git a/src/openapi/common.ts b/src/openapi/common.ts new file mode 100644 index 0000000..302500b --- /dev/null +++ b/src/openapi/common.ts @@ -0,0 +1,150 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * MC Search API + * MC Search API 服务 + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + setFlattenedQueryParams(searchParams, objects); + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/src/openapi/configuration.ts b/src/openapi/configuration.ts new file mode 100644 index 0000000..69ad1e6 --- /dev/null +++ b/src/openapi/configuration.ts @@ -0,0 +1,110 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * MC Search API + * MC Search API 服务 + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + serverIndex?: number; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * override server index + * + * @type {number} + * @memberof Configuration + */ + serverIndex?: number; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.serverIndex = param.serverIndex; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/src/openapi/git_push.sh b/src/openapi/git_push.sh new file mode 100644 index 0000000..f53a75d --- /dev/null +++ b/src/openapi/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/src/openapi/index.ts b/src/openapi/index.ts new file mode 100644 index 0000000..f439770 --- /dev/null +++ b/src/openapi/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * MC Search API + * MC Search API 服务 + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; + diff --git a/src/plugins/backend.ts b/src/plugins/backend.ts new file mode 100644 index 0000000..6011610 --- /dev/null +++ b/src/plugins/backend.ts @@ -0,0 +1,16 @@ +import {SpiderApi, Configuration} from "@/openapi"; +import config from "@/config/config"; + +import pinia from "@/stores/index"; +import {useUserStore} from "@/stores/user"; +const userStore = useUserStore(pinia); + +const conf = new Configuration() +conf.basePath = config.api.baseUrl +conf.apiKey = "Bearer " + userStore.access_token + +const spider = new SpiderApi(conf) + +export { + spider +} \ No newline at end of file diff --git a/src/plugins/registerPlugins.ts b/src/plugins/registerPlugins.ts new file mode 100644 index 0000000..f03572a --- /dev/null +++ b/src/plugins/registerPlugins.ts @@ -0,0 +1,10 @@ +// Types +import type { App } from 'vue' +import router from "@/router"; +import pinia from "@/stores"; + +export function registerPlugins (app: App) { + app + .use(router) + .use(pinia) +} diff --git a/src/router/index.ts b/src/router/index.ts index 5e2a8a1..1660156 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,5 +1,5 @@ import { createRouter, createWebHistory } from 'vue-router' -import HomeView from '../views/HomeView.vue' +import HomeView from '../views/Home.vue' const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -9,14 +9,6 @@ const router = createRouter({ name: 'home', component: HomeView }, - { - path: '/about', - name: 'about', - // route level code-splitting - // this generates a separate chunk (About.[hash].js) for this route - // which is lazy-loaded when the route is visited. - component: () => import('../views/AboutView.vue') - }, { path: '/auth/login', name: 'auth.login', diff --git a/src/stores/index.ts b/src/stores/index.ts new file mode 100644 index 0000000..60ebd95 --- /dev/null +++ b/src/stores/index.ts @@ -0,0 +1,7 @@ +// Utilities +import { createPinia } from 'pinia' +import piniaPluginPersistedstate from 'pinia-plugin-persistedstate' + +const pinia = createPinia().use(piniaPluginPersistedstate) + +export default pinia diff --git a/src/stores/user.ts b/src/stores/user.ts index 04783e1..5649c48 100644 --- a/src/stores/user.ts +++ b/src/stores/user.ts @@ -1,10 +1,22 @@ import {defineStore} from 'pinia' -export const useStore = defineStore('user', { - // persist: true, +export const useUserStore = defineStore('user', { + persist: true, state: () => ({ refresh_token: null as null | string, - jwt_token: null as null | string, + access_token: null as null | string, expired_at: null as null | Date, + user: null as null | any, }), + actions: { + setRefreshToken(refresh_token: string) { + this.refresh_token = refresh_token + }, + setAccessToken(access_token: string) { + this.access_token = access_token + }, + setProfile(user: any) { + this.user = user + }, + } }) \ No newline at end of file diff --git a/src/views/AboutView.vue b/src/views/AboutView.vue deleted file mode 100644 index 756ad2a..0000000 --- a/src/views/AboutView.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - diff --git a/src/views/Home.vue b/src/views/Home.vue new file mode 100644 index 0000000..e1b7a95 --- /dev/null +++ b/src/views/Home.vue @@ -0,0 +1,11 @@ + + + diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue deleted file mode 100644 index d5c0217..0000000 --- a/src/views/HomeView.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/src/views/auth/Login.vue b/src/views/auth/Login.vue index fd556ba..f0197b9 100644 --- a/src/views/auth/Login.vue +++ b/src/views/auth/Login.vue @@ -1,26 +1,45 @@