fix(users): update user role and edit API logic

This commit is contained in:
ghazall-ag
2025-11-09 15:19:14 +03:30
parent fc229cad99
commit 77cc7534a0
3 changed files with 412 additions and 626 deletions

View File

@@ -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);
});
},
},
},
},
})
});