getting somewhere
This commit is contained in:
parent
51d3c76460
commit
9c45a3fb7a
@ -15,6 +15,7 @@ const addState = connect(
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
if (!data.success) return errorToast(data.error_message);
|
||||
console.log(data.response);
|
||||
ws.connect();
|
||||
})
|
||||
.catch(error => errorToast(error));
|
||||
|
||||
@ -20,7 +20,7 @@ use payments::{stripe};
|
||||
|
||||
pub const TOKEN_HEADER: &str = "x-auth-token";
|
||||
|
||||
#[derive(Fail, Debug, Serialize, Deserialize)]
|
||||
#[derive(Clone, Copy, Fail, Debug, Serialize, Deserialize)]
|
||||
pub enum MnmlHttpError {
|
||||
// User Facing Errors
|
||||
#[fail(display="internal server error")]
|
||||
@ -67,7 +67,7 @@ impl From<MnmlHttpError> for IronError {
|
||||
MnmlHttpError::PasswordUnacceptable => (m_err.compat(), status::BadRequest),
|
||||
MnmlHttpError::InvalidCode => (m_err.compat(), status::Unauthorized),
|
||||
};
|
||||
let err_msg = JsonResponse::error("grep".to_string());
|
||||
let err_msg = JsonResponse::error(m_err.to_string());
|
||||
let err_out = serde_json::to_string(&err_msg).expect("Failed to encode response");
|
||||
let content_type = "application/json".parse::<Mime>().expect("Failed to parse content type");
|
||||
|
||||
@ -132,7 +132,15 @@ fn token_res(token: String) -> Response {
|
||||
.max_age(Duration::weeks(1)) // 1 week aligns with db set
|
||||
.finish();
|
||||
|
||||
let mut res = Response::with(status::Ok);
|
||||
let content_type = "application/json".parse::<Mime>().expect("Failed to parse content type");
|
||||
let msg = JsonResponse {
|
||||
response: "success666".to_string(),
|
||||
success: true,
|
||||
error_message: "".to_string()
|
||||
};
|
||||
let msg_out = serde_json::to_string(&msg).expect("Failed to encode response");
|
||||
|
||||
let mut res = Response::with((content_type, status::Ok, msg_out));
|
||||
res.headers.set(SetCookie(vec![v.to_string()]));
|
||||
|
||||
return res;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user