Misc. bugfixes
- Fix duplicate request message showing undefined for requester and state - Fix add request dialog not closing properlymaster
parent
6782ad2fb4
commit
5e42236354
public
|
@ -233,7 +233,7 @@ function validateAndSubmitRequest() {
|
|||
updateTable();
|
||||
document.getElementById("addRequestUrl").value = "";
|
||||
response.text().then((message) => {
|
||||
closeAddRequestModal();
|
||||
closeAllModals();
|
||||
showMessage(message);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -65,7 +65,7 @@ export const getAllRequestsTotal = {
|
|||
|
||||
export const checkRequestExists = {
|
||||
name: "checkRequestExists",
|
||||
text: "SELECT url FROM requests WHERE url = $1"
|
||||
text: "SELECT url,requester,state FROM requests_vw WHERE url = $1"
|
||||
}
|
||||
|
||||
export const addRequest = {
|
||||
|
|
|
@ -97,6 +97,7 @@ export async function addRequest(url: string, requester: string): Promise<[numbe
|
|||
if (!validUrl) return [400, "Invalid song URL."];
|
||||
var result = await checkRequestExists(url)
|
||||
if (result) {
|
||||
console.log(result);
|
||||
return [200,`Song already requested by ${result.rows[0].requester}. State: ${result.rows[0].state}`]
|
||||
}
|
||||
var query = Object.assign(queries.addRequest, { values: [url,requester] });
|
||||
|
|
Loading…
Reference in New Issue