Commit c1a4b680 authored by astavrak's avatar astavrak
Browse files

Branch merged with lexi_omega. Working on POST request handling for Message Form, in progress

parent 394c50ce
......@@ -155,10 +155,12 @@ def validate_login():
def send_messages():
"""Send messages to different users."""
connection = get_db()
message = flask.request.json["form"]["message"]
file_list = flask.request.json["form"]["fileList"]
sender = flask.session["username"]
receiver = flask.request.json["receiver"]
data = request.get_json()
message = data["message"]
# file_list = data["form"]["fileList"]
sender = data["username"]
receiver = data["receiver"]
connection.execute(
"INSERT INTO messages (?, ?, ?)",
......
{"username": "a", "userType": ""}
\ No newline at end of file
{"username": "gmail@gmail.com", "userType": "Family&Friends"}
\ No newline at end of file
......@@ -46,7 +46,28 @@ export default {
},
methods: {
onSubmit() {
this.$alert("Message Form Sent!");
sender_username = localStorage.getItem('username');
let data = {
username: sender_username,
receiver: this.receiver,
message: this.message,
};
fetchAdd(data, "vue-admin-template/user/form")
.then((response) => {
if (response.message === false) {
this.$alert("Please enter a valid receiver.");
} else {
this.$alert("Message Sent!");
}
})
.catch(() => {
this.$notify({
title: "Failure",
message: "Error occurred. Please try again.",
type: "info",
duration: 2000,
});
});
},
onCancel() {
this.$message({
......
Supports Markdown
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