Skip to content

Commit

Permalink
make ref
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Jun 14, 2024
1 parent 808b066 commit c3155ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/bin/command/auth/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ impl CreateSession {
let url = Url::parse(&self.rpc_url)?;
let chain_id = get_network_chain_id(url.clone()).await?;
let session = session::create(url, &self.policies).await?;

session::store(chain_id, session)
session::store(chain_id, &session)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn get(chain_id: FieldElement) -> anyhow::Result<SessionDetails> {
}

/// Stores the session on-disk.
pub fn store(chain_id: FieldElement, session: SessionDetails) -> anyhow::Result<()> {
pub fn store(chain_id: FieldElement, session: &SessionDetails) -> anyhow::Result<()> {
// TODO: maybe can store the authenticated user in a global variable so that
// we don't have to call load again if we already did it before.
let credentials = Credentials::load()?;
Expand All @@ -64,7 +64,7 @@ pub fn store(chain_id: FieldElement, session: SessionDetails) -> anyhow::Result<
}
}

let contents = serde_json::to_string_pretty(&session)?;
let contents = serde_json::to_string_pretty(session)?;
fs::write(&path, contents)?;
trace!(path = %path.display(), "Session token stored successfully.");

Expand Down

0 comments on commit c3155ac

Please sign in to comment.