Skip to content

Commit

Permalink
Merge pull request #38 from openworld-community/api-connection
Browse files Browse the repository at this point in the history
Api connection
  • Loading branch information
kosmos-954 authored Jul 9, 2023
2 parents f502219 + 9e57731 commit 87a99a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_API_SERVER=https://test.eventmanagerbot.peredelano.io
VITE_API_PORT=8443
13 changes: 9 additions & 4 deletions src/lib/logic/editForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ export const formDataStores = editFormData.map((item) => {
export const submitForm = createEvent<HTMLFormElement>();

const submitFormFx = createEffect(async (data: Record<string, string>) => {
const apiServer = import.meta.env.VITE_API_SERVER;
const apiPort = import.meta.env.VITE_API_PORT;
const response = await axios.post(`${apiServer}:${apiPort}/event`, data);
return response.data;
try {
const apiServer = import.meta.env.VITE_API_SERVER;
const apiPort = import.meta.env.VITE_API_PORT;
const response = await axios.post(`${apiServer}:${apiPort}/event`, data);
return response.data;
} catch (error) {
console.error(error);
return error;
}
});

const formMapper = (storesData: string[]) => {
Expand Down

0 comments on commit 87a99a5

Please sign in to comment.