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 = () => { ...@@ -13,7 +13,7 @@ const AuthPage: React.FC = () => {
const handleLogin = async () => { const handleLogin = async () => {
try { try {
const response = await fetch('http://77.243.80.217:8080/esutd/api/organizations/list', { const response = await fetch('/esutd/api/organizations/list', {
headers: { headers: {
'Authorization': `Bearer ${token}`, 'Authorization': `Bearer ${token}`,
}, },
......
...@@ -3,7 +3,6 @@ import { RootState } from '@/main'; ...@@ -3,7 +3,6 @@ import { RootState } from '@/main';
import { notification } from 'antd'; import { notification } from 'antd';
const baseQuery = fetchBaseQuery({ const baseQuery = fetchBaseQuery({
baseUrl: 'http://77.243.80.217/esutd/api',
prepareHeaders: (headers, { getState }) => { prepareHeaders: (headers, { getState }) => {
const accessToken = (getState() as RootState).auth.token; const accessToken = (getState() as RootState).auth.token;
......
...@@ -4,7 +4,7 @@ export const manualApiSlice = apiSlice.injectEndpoints({ ...@@ -4,7 +4,7 @@ export const manualApiSlice = apiSlice.injectEndpoints({
endpoints: (builder) => ({ endpoints: (builder) => ({
updateDictionary: builder.mutation({ updateDictionary: builder.mutation({
query: (codes) => ({ query: (codes) => ({
url: 'dictionary/update', url: '/esutd/api/dictionary/update',
method: 'POST', method: 'POST',
body: codes body: codes
}), invalidatesTags: [{ type: "manuals", id: "MAN_LIST" }] }), invalidatesTags: [{ type: "manuals", id: "MAN_LIST" }]
......
...@@ -17,16 +17,16 @@ interface Organization { ...@@ -17,16 +17,16 @@ interface Organization {
export const organizationApiSlice = apiSlice.injectEndpoints({ export const organizationApiSlice = apiSlice.injectEndpoints({
endpoints: (builder) => ({ endpoints: (builder) => ({
getOrganizations: builder.query<Organization[], void>({ getOrganizations: builder.query<Organization[], void>({
query: () => 'organizations/list', query: () => '/esutd/api/organizations/list',
providesTags: [{ type: "organizations", id: "ORG_LIST" }], providesTags: [{ type: "organizations", id: "ORG_LIST" }],
}), }),
getOrganization: builder.query<Organization, string>({ 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 }] providesTags: (_, __, arg) => [{ type: "organizations", id: arg }]
}), }),
editOrganization: builder.mutation<Organization, Partial<Organization>>({ editOrganization: builder.mutation<Organization, Partial<Organization>>({
query: ( initialOrg ) => ({ query: ( initialOrg ) => ({
url: `organizations/save?id=${initialOrg.id}`, url: `/esutd/api/organizations/save?id=${initialOrg.id}`,
method: 'POST', method: 'POST',
body: initialOrg, body: initialOrg,
}), }),
...@@ -34,7 +34,7 @@ export const organizationApiSlice = apiSlice.injectEndpoints({ ...@@ -34,7 +34,7 @@ export const organizationApiSlice = apiSlice.injectEndpoints({
}), }),
deleteOrganization: builder.mutation<{ success: boolean; code: string }, string>({ deleteOrganization: builder.mutation<{ success: boolean; code: string }, string>({
query: (orgCode) => ({ query: (orgCode) => ({
url: `organizations/delete?code=${orgCode}`, url: `/esutd/api/organizations/delete?code=${orgCode}`,
method: 'POST' method: 'POST'
}), }),
invalidatesTags: [{ type: "organizations", id: "ORG_LIST" }], invalidatesTags: [{ type: "organizations", id: "ORG_LIST" }],
......
...@@ -29,19 +29,19 @@ const getRequestsParams = { ...@@ -29,19 +29,19 @@ const getRequestsParams = {
export const requestApiSlice = apiSlice.injectEndpoints({ export const requestApiSlice = apiSlice.injectEndpoints({
endpoints: (builder) => ({ endpoints: (builder) => ({
getRequests: builder.query<RequestsResponse, void>({ 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" }], providesTags: [{ type: "requests", id: "REQ_LIST" }],
}), }),
addNewRequest: builder.mutation<Request, Partial<Request>>({ addNewRequest: builder.mutation<Request, Partial<Request>>({
query: (initialReq) => ({ query: (initialReq) => ({
url: 'requests/save', url: '/esutd/api/requests/save',
method: 'POST', method: 'POST',
body: initialReq, body: initialReq,
}), }),
invalidatesTags: [{ type: "requests", id: "REQ_LIST" }], invalidatesTags: [{ type: "requests", id: "REQ_LIST" }],
}), }),
resendRequest: builder.query({ resendRequest: builder.query({
query: (reqId) => `requests/resent?id=${reqId}`, query: (reqId) => `/esutd/api/requests/resent?id=${reqId}`,
providesTags: (_, __, arg) => [{ type: "requests", id: arg }] providesTags: (_, __, arg) => [{ type: "requests", id: arg }]
}) })
}) })
......
...@@ -10,11 +10,11 @@ export default defineConfig({ ...@@ -10,11 +10,11 @@ export default defineConfig({
}, },
server: { server: {
proxy: { proxy: {
'/api': { '/esutd': {
target: 'http://77.243.80.217:8080', target: 'http://77.243.80.217:8080',
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
secure: false, 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