Commit 58a51d68 authored by Merekeyev Dias's avatar Merekeyev Dias

Boris fixed cors problem, what a nice lad

parent cb5ab658
......@@ -13,7 +13,7 @@ const AuthPage: React.FC = () => {
const handleLogin = async () => {
try {
const response = await fetch('http://77.243.80.217:8080/esutd/api/organizations/list', {
const response = await fetch('/esutd/api/organizations/list', {
headers: {
'Authorization': `Bearer ${token}`,
},
......
......@@ -3,7 +3,6 @@ import { RootState } from '@/main';
import { notification } from 'antd';
const baseQuery = fetchBaseQuery({
baseUrl: 'http://77.243.80.217/esutd/api',
prepareHeaders: (headers, { getState }) => {
const accessToken = (getState() as RootState).auth.token;
......
......@@ -4,7 +4,7 @@ export const manualApiSlice = apiSlice.injectEndpoints({
endpoints: (builder) => ({
updateDictionary: builder.mutation({
query: (codes) => ({
url: 'dictionary/update',
url: '/esutd/api/dictionary/update',
method: 'POST',
body: codes
}), invalidatesTags: [{ type: "manuals", id: "MAN_LIST" }]
......
......@@ -17,16 +17,16 @@ interface Organization {
export const organizationApiSlice = apiSlice.injectEndpoints({
endpoints: (builder) => ({
getOrganizations: builder.query<Organization[], void>({
query: () => 'organizations/list',
query: () => '/esutd/api/organizations/list',
providesTags: [{ type: "organizations", id: "ORG_LIST" }],
}),
getOrganization: builder.query<Organization, string>({
query: (orgId) => `organizations/info?id=${orgId}`,
query: (orgId) => `/esutd/api/organizations/info?id=${orgId}`,
providesTags: (_, __, arg) => [{ type: "organizations", id: arg }]
}),
editOrganization: builder.mutation<Organization, Partial<Organization>>({
query: ( initialOrg ) => ({
url: `organizations/save?id=${initialOrg.id}`,
url: `/esutd/api/organizations/save?id=${initialOrg.id}`,
method: 'POST',
body: initialOrg,
}),
......@@ -34,7 +34,7 @@ export const organizationApiSlice = apiSlice.injectEndpoints({
}),
deleteOrganization: builder.mutation<{ success: boolean; code: string }, string>({
query: (orgCode) => ({
url: `organizations/delete?code=${orgCode}`,
url: `/esutd/api/organizations/delete?code=${orgCode}`,
method: 'POST'
}),
invalidatesTags: [{ type: "organizations", id: "ORG_LIST" }],
......
......@@ -29,19 +29,19 @@ const getRequestsParams = {
export const requestApiSlice = apiSlice.injectEndpoints({
endpoints: (builder) => ({
getRequests: builder.query<RequestsResponse, void>({
query: () => `requests/list?pageNumber=${getRequestsParams.pageNumber}&pageSize=${getRequestsParams.pageSize}`,
query: () => `/esutd/api/requests/list?pageNumber=${getRequestsParams.pageNumber}&pageSize=${getRequestsParams.pageSize}`,
providesTags: [{ type: "requests", id: "REQ_LIST" }],
}),
addNewRequest: builder.mutation<Request, Partial<Request>>({
query: (initialReq) => ({
url: 'requests/save',
url: '/esutd/api/requests/save',
method: 'POST',
body: initialReq,
}),
invalidatesTags: [{ type: "requests", id: "REQ_LIST" }],
}),
resendRequest: builder.query({
query: (reqId) => `requests/resent?id=${reqId}`,
query: (reqId) => `/esutd/api/requests/resent?id=${reqId}`,
providesTags: (_, __, arg) => [{ type: "requests", id: arg }]
})
})
......
......@@ -8,13 +8,13 @@ export default defineConfig({
'@': '/src',
},
},
server: {
server: {
proxy: {
'/api': {
'/esutd': {
target: 'http://77.243.80.217:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
secure: false,
rewrite: (path) => path.replace(/^\/api/, ''),
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment