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