Browse Source

http修改

tongshangming 2 years ago
parent
commit
c6d3b49d58
1 changed files with 2 additions and 1 deletions
  1. 2 1
      utils/http.js

+ 2 - 1
utils/http.js

@@ -2,8 +2,8 @@ import { useUserStore } from '@/stores/user'
 import config from './config'
 import utils from './utils'
 
-const userStore = useUserStore()
 const request = (method, url, data, opt) => {
+	const userStore = useUserStore()
 	return new Promise((resolve, reject) => {
 		opt.showLoading && uni.showLoading({
 			title: opt.loadingTitle,
@@ -61,6 +61,7 @@ methods.forEach(method => {
 		)
 
 		if (opt.isAuth) {
+			const userStore = useUserStore()
 			if (!userStore.token) {
 				// uni.navigateTo({
 				// 	url: '/pages/login/login'