-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
necessary fixes: TODO.md
- Loading branch information
Showing
19 changed files
with
777 additions
and
585 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
- refactor update a delete v UFO-A na postData | ||
- zkusit abstrahovat lock na withLock | ||
- opravit mazani entit na serveru | ||
- mazani grafiky entit | ||
- UFO-B mazani elementu: pridat mazani grafiky | ||
|
||
- refactor to https://www.primefaces.org/primereact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,40 @@ | ||
// @flow | ||
|
||
export const requestFailedMsg = "Request to server failed"; | ||
export function ajax(url: string, method: "POST" | "GET", data: any): Promise<any> { | ||
const params = { | ||
method, | ||
body: data ? JSON.stringify(data) : null, | ||
headers: { | ||
"Content-Type": "application/json" | ||
}, | ||
credentials: "same-origin" | ||
}; | ||
|
||
export function getData(url: string): Promise<any> { | ||
return new Promise((resolve, reject) => { | ||
$.get(url, (data: any, status: String) => { | ||
if (status !== "success") { | ||
console.error(status); | ||
reject(status); | ||
} else { | ||
resolve(data); | ||
} | ||
}).fail(() => reject(requestFailedMsg)); | ||
fetch(url, params).then( | ||
response => { | ||
if (response.status !== 200) { | ||
reject(response.statusText); | ||
} else { | ||
if (method === "GET") { | ||
resolve(response.json()); | ||
} else { | ||
resolve(); | ||
} | ||
} | ||
}, | ||
error => reject(error.message) | ||
); | ||
}); | ||
} | ||
|
||
export function getData(url: string): Promise<any> { | ||
return ajax(url, "GET", null); | ||
} | ||
|
||
export function postData(url: string, data: any): Promise<any> { | ||
return new Promise((resolve, reject) => { | ||
$.post(url, data, (response) => { | ||
if (response.error) { | ||
console.error(response.error); | ||
reject(response.error); | ||
} else { | ||
resolve(response.result); | ||
} | ||
}).fail(() => reject(requestFailedMsg)); | ||
}); | ||
return ajax(url, "POST", data); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -482,13 +482,5 @@ | |
"e120": { | ||
"x": -1973, | ||
"y": -1071 | ||
}, | ||
"e121": { | ||
"x": -1897, | ||
"y": -1318 | ||
}, | ||
"e122": { | ||
"x": -267, | ||
"y": -9082 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -482,13 +482,5 @@ | |
"e120": { | ||
"x": -1973, | ||
"y": -1071 | ||
}, | ||
"e121": { | ||
"x": -1897, | ||
"y": -1318 | ||
}, | ||
"e122": { | ||
"x": -267, | ||
"y": -9082 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.