fix(users): update user role and edit API logic
This commit is contained in:
@@ -1,23 +1,36 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://khalijpay-core.qaserver.ir',
|
||||
"/api": {
|
||||
target: "https://khalijpay-core.qaserver.ir",
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
// اجازه ارسال کوکیها
|
||||
configure: (proxy) => {
|
||||
proxy.on('proxyReq', (proxyReq, req) => {
|
||||
// Ensure cookies are forwarded for withCredentials
|
||||
proxy.on("proxyReq", (proxyReq, req) => {
|
||||
const origin = req.headers.origin;
|
||||
if (origin) proxyReq.setHeader('origin', origin);
|
||||
if (origin) {
|
||||
proxyReq.setHeader("origin", origin);
|
||||
}
|
||||
// اضافه کردن این خط برای اطمینان از ارسال کوکیها
|
||||
proxyReq.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
});
|
||||
|
||||
proxy.on("proxyRes", (proxyRes) => {
|
||||
// اطمینان از دریافت کوکی از سرور
|
||||
proxyRes.headers["Access-Control-Allow-Origin"] = "http://localhost:5173";
|
||||
proxyRes.headers["Access-Control-Allow-Credentials"] = "true";
|
||||
});
|
||||
|
||||
proxy.on("error", (err) => {
|
||||
console.log("Proxy Error:", err);
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user