From f87b854bb271cad5df02c4d5f6d3affb95d81bb6 Mon Sep 17 00:00:00 2001 From: hynseok Date: Mon, 4 Nov 2024 00:37:48 +0900 Subject: [PATCH] frontend: fix env load --- frontend/src/build.rs | 6 ------ frontend/src/components/form.rs | 4 +--- frontend/src/env.rs | 3 --- frontend/src/lib.rs | 3 --- frontend/static/index.html | 9 ++++++++- 5 files changed, 9 insertions(+), 16 deletions(-) delete mode 100644 frontend/src/build.rs delete mode 100644 frontend/src/env.rs diff --git a/frontend/src/build.rs b/frontend/src/build.rs deleted file mode 100644 index 6a2df86..0000000 --- a/frontend/src/build.rs +++ /dev/null @@ -1,6 +0,0 @@ -use std::env; - -fn main() { - let api_url = env::var("API_URL").expect("API_URL must be set"); - println!("cargo:rustc-env=API_URL={}", api_url); -} \ No newline at end of file diff --git a/frontend/src/components/form.rs b/frontend/src/components/form.rs index 68e18c6..7fab859 100644 --- a/frontend/src/components/form.rs +++ b/frontend/src/components/form.rs @@ -3,8 +3,6 @@ use yew::format::{Json, Nothing}; use yew::prelude::*; use yew::services::fetch::{FetchService, FetchTask, Request, Response}; -use crate::get_api_url; - #[derive(Serialize)] struct FormData { name: String, @@ -67,7 +65,7 @@ impl Component for Form { content: self.content.clone(), }; - let request = Request::post(get_api_url()) + let request = Request::post("https://ask.scg.skku.ac.kr/v1/send") .header("Content-Type", "application/json; charset=utf-8") .body(Json(&form_data)) .expect("Could not build request."); diff --git a/frontend/src/env.rs b/frontend/src/env.rs deleted file mode 100644 index e6fb7f4..0000000 --- a/frontend/src/env.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn get_api_url() -> &'static str { - env!("API_URL") -} diff --git a/frontend/src/lib.rs b/frontend/src/lib.rs index bb7aef7..02a1fc5 100644 --- a/frontend/src/lib.rs +++ b/frontend/src/lib.rs @@ -1,12 +1,9 @@ // src/lib.rs mod app; mod components; -mod env; mod pages; mod route; -mod build; -use env::*; use wasm_bindgen::prelude::*; use yew::prelude::*; diff --git a/frontend/static/index.html b/frontend/static/index.html index 9bbcdd7..6eea5e7 100644 --- a/frontend/static/index.html +++ b/frontend/static/index.html @@ -10,7 +10,14 @@ - + + + + + + + +