Fix paths

This commit is contained in:
eraden 2022-04-16 20:20:59 +02:00
parent b115896aa3
commit 5bdcaf4298
3 changed files with 14 additions and 15 deletions

View File

@ -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;

View File

@ -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(
scope("/admin")
.service(sign_in)
.service(logout)
.service(register)
.service(actix_web::web::scope("/api/v1").configure(api_v1::configure)),
)
.service(landing);
config.service(
scope("/admin")
.service(sign_in)
.service(logout)
.service(register)
.service(landing)
.configure(api_v1::configure),
);
}

View File

@ -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)
}