Skip to content

Commit bf2d2e8

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

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
@@ -2028,7 +2028,7 @@ impl Shuttle {
20282028
Ok(())
20292029
}
20302030

2031-
async fn project_delete(&self, no_confirm: bool) -> Result<()> {
2031+
async fn project_delete(&mut self, no_confirm: bool) -> Result<()> {
20322032
let client = self.client.as_ref().unwrap();
20332033
let pid = self.ctx.project_id();
20342034

@@ -2064,6 +2064,9 @@ impl Shuttle {
20642064

20652065
let res = client.delete_project(pid).await?.into_inner();
20662066

2067+
self.ctx.remove_project_id();
2068+
self.ctx.save_local_internal()?;
2069+
20672070
println!("{res}");
20682071

20692072
Ok(())

0 commit comments

Comments
 (0)