Fix paths
This commit is contained in:
parent
b115896aa3
commit
5bdcaf4298
@ -38,7 +38,7 @@
|
|||||||
let params = {};
|
let params = {};
|
||||||
const method = mthEl.value;
|
const method = mthEl.value;
|
||||||
|
|
||||||
paramsEl.textContent.split("\n").forEach(s => {
|
paramsEl.value.split("\n").forEach(s => {
|
||||||
if (!s.length) return;
|
if (!s.length) return;
|
||||||
let [k, v] = s.split("=");
|
let [k, v] = s.split("=");
|
||||||
params[k] = v;
|
params[k] = v;
|
||||||
|
@ -61,7 +61,7 @@ pub struct SignInInput {
|
|||||||
password: Password,
|
password: Password,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("sign-in")]
|
#[post("/sign-in")]
|
||||||
async fn sign_in(
|
async fn sign_in(
|
||||||
session: Session,
|
session: Session,
|
||||||
db: Data<Addr<Database>>,
|
db: Data<Addr<Database>>,
|
||||||
@ -114,7 +114,7 @@ pub enum RegisterError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// login_required
|
// login_required
|
||||||
#[post("register")]
|
#[post("/register")]
|
||||||
async fn register(
|
async fn register(
|
||||||
session: Session,
|
session: Session,
|
||||||
Json(input): Json<RegisterInput>,
|
Json(input): Json<RegisterInput>,
|
||||||
@ -166,7 +166,7 @@ async fn register(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/admin")]
|
#[get("")]
|
||||||
async fn landing() -> Result<HttpResponse> {
|
async fn landing() -> Result<HttpResponse> {
|
||||||
Ok(HttpResponse::NotImplemented()
|
Ok(HttpResponse::NotImplemented()
|
||||||
.append_header(("Content-Type", "text/html"))
|
.append_header(("Content-Type", "text/html"))
|
||||||
@ -174,13 +174,12 @@ async fn landing() -> Result<HttpResponse> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn configure(config: &mut ServiceConfig) {
|
pub fn configure(config: &mut ServiceConfig) {
|
||||||
config
|
config.service(
|
||||||
.service(
|
scope("/admin")
|
||||||
scope("/admin")
|
.service(sign_in)
|
||||||
.service(sign_in)
|
.service(logout)
|
||||||
.service(logout)
|
.service(register)
|
||||||
.service(register)
|
.service(landing)
|
||||||
.service(actix_web::web::scope("/api/v1").configure(api_v1::configure)),
|
.configure(api_v1::configure),
|
||||||
)
|
);
|
||||||
.service(landing);
|
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,12 @@ use crate::public_send_db;
|
|||||||
use crate::routes::admin::Error;
|
use crate::routes::admin::Error;
|
||||||
use crate::routes::Result;
|
use crate::routes::Result;
|
||||||
|
|
||||||
#[get("products")]
|
#[get("/products")]
|
||||||
async fn products(db: Data<Addr<Database>>) -> Result<HttpResponse> {
|
async fn products(db: Data<Addr<Database>>) -> Result<HttpResponse> {
|
||||||
public_send_db!(db.into_inner(), database::AllProducts)
|
public_send_db!(db.into_inner(), database::AllProducts)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("stocks")]
|
#[get("/stocks")]
|
||||||
async fn stocks(db: Data<Addr<Database>>) -> Result<HttpResponse> {
|
async fn stocks(db: Data<Addr<Database>>) -> Result<HttpResponse> {
|
||||||
public_send_db!(db.into_inner(), database::AllStocks)
|
public_send_db!(db.into_inner(), database::AllStocks)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user