Skip to content

Commit

Permalink
add long http
Browse files Browse the repository at this point in the history
  • Loading branch information
mingchiuli committed Jan 14, 2025
1 parent 7368321 commit d9c95da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/utils/tools.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import http from '@/http/axios'
import client from '@/http/axios'
import { DOWNLOAD_DATA, GET, POST } from '@/http/http'
import router from '@/router'
import { buttonStore, loginStateStore, menuStore, tabStore, authMarkStore } from '@/stores/store'
Expand Down Expand Up @@ -74,7 +74,7 @@ export const checkAccessToken = async (accessToken: string): Promise<string> =>
//ten minutes
if (jwt.exp - now < 600) {
const refreshToken = getLocalStorageItem('refreshToken')
const data = await http.get<never, Data<RefreshStruct>>('/token/refresh', {
const data = await client.http.get<never, Data<RefreshStruct>>('/token/refresh', {
headers: { Authorization: refreshToken }
})
const token = data.data.accessToken
Expand Down
5 changes: 2 additions & 3 deletions src/views/LoginView.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { reactive, ref } from 'vue'
import type { LoginStruct } from '@/type/entity'
import http from '@/http/axios'
import { GET } from '@/http/http'
import { submitLogin } from '@/utils/tools'
const mailButtonDisable = ref(false)
Expand Down Expand Up @@ -41,8 +41,7 @@ const sendCode = (via: string) => {
if (!loginInfo.username) return
smsButtonDisable.value = true
mailButtonDisable.value = true
http
.get(`/code/${via}?loginName=${loginInfo.username}`)
GET(`/code/${via}?loginName=${loginInfo.username}`)
.then((_res) => {
ElMessage.success('发送成功')
interval = setInterval(() => {
Expand Down

0 comments on commit d9c95da

Please sign in to comment.