mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 17:14:50 +00:00
feat: preferences syncing frontend (#7192)
* feat: prefs frontend * fix: DI issue * fix: lint * feat: appearance settings cleanup + fix settings, remove pinia * fix: sync btn when logged out * fix: prepr * fix: sidebar issue * feat: language coverage + cleanup * feat: cleanup lang settings * fix: fmt * fix: CI * fix: ci * fix: storybook * feat: bring back loader/game version sort --------- Co-authored-by: tdgao <mr.trumgao@gmail.com>
This commit is contained in:
@@ -109,6 +109,51 @@ pub async fn get_user_collections(user_id: &str) -> crate::Result<Value> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn get_user_preferences(user_id: &str) -> crate::Result<Value> {
|
||||
let state = State::get().await?;
|
||||
let user_id = urlencoding::encode(user_id);
|
||||
|
||||
fetch_json(
|
||||
Method::GET,
|
||||
&format!(
|
||||
"{}user/{}/preferences",
|
||||
env!("MODRINTH_API_URL_V3"),
|
||||
user_id
|
||||
),
|
||||
None,
|
||||
None,
|
||||
Some("/v3/user/:id/preferences"),
|
||||
&state.api_semaphore,
|
||||
&state.pool,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(preferences))]
|
||||
pub async fn patch_user_preferences(
|
||||
user_id: &str,
|
||||
preferences: Value,
|
||||
) -> crate::Result<Value> {
|
||||
let state = State::get().await?;
|
||||
let user_id = urlencoding::encode(user_id);
|
||||
|
||||
fetch_json(
|
||||
Method::PATCH,
|
||||
&format!(
|
||||
"{}user/{}/preferences",
|
||||
env!("MODRINTH_API_URL_V3"),
|
||||
user_id
|
||||
),
|
||||
None,
|
||||
Some(preferences),
|
||||
Some("/v3/user/:id/preferences"),
|
||||
&state.api_semaphore,
|
||||
&state.pool,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(patch))]
|
||||
pub async fn patch_user(user_id: &str, patch: Value) -> crate::Result<()> {
|
||||
let state = State::get().await?;
|
||||
|
||||
Reference in New Issue
Block a user