Skip to content

Commit

Permalink
finish developer update
Browse files Browse the repository at this point in the history
  • Loading branch information
Fleeym committed Jun 7, 2024
1 parent dd1529b commit 00aa6b5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/index_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fmt::Display;

use crate::{
config::Config,
fatal,
fail, fatal,
index::{self, AdminAction},
index_dev::{self, DeveloperProfile},
info,
Expand Down Expand Up @@ -301,7 +301,6 @@ fn update_dev_status(config: &Config) {
return;
}
let developer = developer.unwrap();
println!("{}", developer);
let mut verified = developer.verified;
loop {
let status = ask_value("New status (verified/unverified)", None, true);
Expand All @@ -319,12 +318,25 @@ fn update_dev_status(config: &Config) {
verified = false;
break;
}
} else {
warn!("Invalid option");
}
}

let client = reqwest::blocking::Client::new();

let url = index::get_index_url(format!("/v1/developers/{}", username).to_string(), config);
let response = client
.post(url)
.json(&json!({ "verified": verified }))
.send()
.nice_unwrap("Failed to update developer");

if response.status() != 204 {
fail!("Failed to upadte developer");
}

info!("Developer updated successfully");
}

fn validate_mod(version: &PendingModVersion, id: &str, config: &Config) {
Expand Down

0 comments on commit 00aa6b5

Please sign in to comment.