Skip to content

Commit 39dfc9e

Browse files
committed
Refactor API token update logic and replace make_api_call with make_request
1 parent 587c56b commit 39dfc9e

File tree

3 files changed

+5
-25
lines changed

3 files changed

+5
-25
lines changed

frontend/common/src/utils/ext_traits.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,3 @@ where
4646
Signal::derive(move || f(self.get()))
4747
}
4848
}
49-
50-
/// A trait to extend the [`String`] type with some useful methods that are not
51-
/// available in the standard library. This is useful for adding utility methods
52-
/// to the [`String`] type without polluting the global namespace.
53-
pub trait StringExt {
54-
/// Wraps the [`String`] into an option depending on whether it's empty
55-
/// Returns [`None`] if string is empty otherwise returns the string wrapped
56-
/// in a [`Some()`]
57-
fn some_if_not_empty(self) -> Option<String>;
58-
}
59-
60-
impl StringExt for String {
61-
fn some_if_not_empty(self) -> Option<String> {
62-
if self.is_empty() {
63-
None
64-
} else {
65-
Some(self)
66-
}
67-
}
68-
}

old-frontend/src/pages/auth/login.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub async fn login(
1818
let LoginResponse {
1919
access_token,
2020
refresh_token,
21-
} = make_api_call::<LoginRequest>(
21+
} = make_request::<LoginRequest>(
2222
ApiRequest::builder()
2323
.path(LoginPath)
2424
.query(())
@@ -35,7 +35,7 @@ pub async fn login(
3535
.await?
3636
.body;
3737

38-
let workspaces = make_api_call::<ListUserWorkspacesRequest>(
38+
let workspaces = make_request::<ListUserWorkspacesRequest>(
3939
ApiRequest::builder()
4040
.path(ListUserWorkspacesPath)
4141
.query(())

old-frontend/src/pages/auth/sign_up.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub async fn sign_up(
1313
username: String,
1414
password: String,
1515
) -> Result<(), ServerFnError<ErrorType>> {
16-
make_api_call::<CreateAccountRequest>(
16+
make_request::<CreateAccountRequest>(
1717
ApiRequest::builder()
1818
.path(CreateAccountPath)
1919
.query(())
@@ -80,7 +80,7 @@ pub fn SignUpForm(
8080
// }
8181

8282
// let Ok(IsEmailValidResponse { available }) =
83-
// make_api_call::<IsEmailValidRequest>( ApiRequest::builder()
83+
// make_request::<IsEmailValidRequest>( ApiRequest::builder()
8484
// .path(IsEmailValidPath)
8585
// .query(IsEmailValidQuery { email })
8686
// .headers(IsEmailValidRequestHeaders {
@@ -121,7 +121,7 @@ pub fn SignUpForm(
121121
// }
122122

123123
// let Ok(IsUsernameValidResponse { available }) =
124-
// make_api_call::<IsUsernameValidRequest>(
124+
// make_request::<IsUsernameValidRequest>(
125125
// ApiRequest::builder()
126126
// .path(IsUsernameValidPath)
127127
// .query(IsUsernameValidQuery { username })

0 commit comments

Comments
 (0)