PASSAGGIO A VITE !
AGG. 1.1.23
This commit is contained in:
@@ -11,8 +11,8 @@ import { tools } from '@src/store/Modules/tools'
|
||||
import { toolsext } from '@src/store/Modules/toolsext'
|
||||
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
import router from '@router'
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
|
||||
import type * as Types from '@src/store/Api/ApiTypes'
|
||||
import { costanti } from '@src/store/Modules/costanti'
|
||||
import * as ApiTables from '@src/store/Modules/ApiTables'
|
||||
import sendRequest from './Inst-Pao'
|
||||
@@ -77,7 +77,7 @@ export const Api = {
|
||||
},
|
||||
|
||||
async checkSession({ token, refresh_token }: any) {
|
||||
return axios.post(process.env.API_URL + Paths.TOKEN_REFRESH, {
|
||||
return axios.post(import.meta.env.API_URL + Paths.TOKEN_REFRESH, {
|
||||
refresh_token,
|
||||
}, {
|
||||
headers: {
|
||||
@@ -145,8 +145,7 @@ export const Api = {
|
||||
return resolve(this.SendReq(url, method, mydata, setAuthToken, true));
|
||||
}
|
||||
} else {
|
||||
const $router = useRouter()
|
||||
$router.push('/signin')
|
||||
// $router.push('/signin')
|
||||
}
|
||||
} catch (err2: any) {
|
||||
console.error('err2, Token Invalido', err2)
|
||||
@@ -165,20 +164,20 @@ export const Api = {
|
||||
async SendReqBase(url: string, method: string, mydata: any, setAuthToken = false, evitaloop = false, myformdata?: any, responsedata?: any, options?: any): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||
const mydataout = {
|
||||
...mydata,
|
||||
keyappid: process.env.PAO_APP_ID,
|
||||
idapp: process.env.APP_ID,
|
||||
keyappid: import.meta.env.VITE_PAO_APP_ID,
|
||||
idapp: tools.getEnv('VITE_APP_ID'),
|
||||
}
|
||||
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const $router = useRouter()
|
||||
|
||||
|
||||
userStore.setServerCode(tools.EMPTY)
|
||||
userStore.setResStatus(0)
|
||||
|
||||
return new Promise((resolve, reject) => sendRequest(url, method, mydataout, myformdata, responsedata, options)
|
||||
.then(async (res) => {
|
||||
setTimeout( () => {
|
||||
setTimeout(() => {
|
||||
if (method === 'get') {
|
||||
globalStore.connData.downloading_server = 0
|
||||
} else {
|
||||
@@ -229,14 +228,14 @@ export const Api = {
|
||||
/**
|
||||
* Creates a Promise that resolves after a specified number of milliseconds.
|
||||
* Useful for creating delayed operations or pause in async functions.
|
||||
*
|
||||
*
|
||||
* @param ms - The number of milliseconds to delay
|
||||
* @returns A Promise that resolves after the specified delay
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* // Basic usage
|
||||
* await delay(1000); // waits for 1 second
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* // Usage in an async function
|
||||
* async function example() {
|
||||
@@ -244,7 +243,7 @@ export const Api = {
|
||||
* await delay(2000);
|
||||
* console.log('2 seconds later');
|
||||
* }
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* // Usage with Promise chaining
|
||||
* delay(1000).then(() => console.log('1 second passed'));
|
||||
|
||||
Reference in New Issue
Block a user