Skip to content

Commit 2376398

Browse files
committed
feat: remove id from local config after deleting project
1 parent c8bb693 commit 2376398

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

cargo-shuttle/src/config.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ impl RequestContext {
169169
InternalProjectConfig { id: Some(id) };
170170
}
171171

172+
pub fn remove_project_id(&mut self) {
173+
*self.project_internal.as_mut().unwrap().as_mut().unwrap() =
174+
InternalProjectConfig { id: None };
175+
}
176+
172177
pub fn save_local_internal(&mut self) -> Result<()> {
173178
self.project_internal.as_ref().unwrap().save()?;
174179

cargo-shuttle/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1897,7 +1897,7 @@ impl Shuttle {
18971897
Ok(())
18981898
}
18991899

1900-
async fn project_delete(&self, no_confirm: bool) -> Result<()> {
1900+
async fn project_delete(&mut self, no_confirm: bool) -> Result<()> {
19011901
let client = self.client.as_ref().unwrap();
19021902
let pid = self.ctx.project_id();
19031903

@@ -1933,6 +1933,9 @@ impl Shuttle {
19331933

19341934
let res = client.delete_project(pid).await?.into_inner();
19351935

1936+
self.ctx.remove_project_id();
1937+
self.ctx.save_local_internal()?;
1938+
19361939
println!("{res}");
19371940

19381941
Ok(())

0 commit comments

Comments
 (0)