Skip to content

Commit

Permalink
use update instead of query for get_messages method
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico authored and Federico committed Sep 1, 2022
1 parent b128146 commit f3a23a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/ic/src/tera/src/api/messages.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use candid::candid_method;
use ic_cdk_macros::{query, update};
use ic_cdk_macros::update;

use super::admin::is_authorized;
use crate::{
Expand All @@ -13,8 +13,8 @@ fn remove_messages(messages: Vec<OutgoingMessagePair>) -> RemoveMessagesResponse
STATE.with(|s| RemoveMessagesResponse(s.remove_messages(messages)))
}

#[query(name = "get_messages", guard = "is_authorized")]
#[candid_method(query, rename = "get_messages")]
#[update(name = "get_messages", guard = "is_authorized")]
#[candid_method(update, rename = "get_messages")]
fn get_messages() -> Vec<OutgoingMessagePair> {
STATE.with(|s| s.get_messages())
}
Expand Down
2 changes: 1 addition & 1 deletion core/ic/src/tera/tera.did
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type StoreMessageResponse = variant { Ok : CallResult; Err : text };
service : {
authorize : (principal) -> ();
consume_message : (principal, vec nat8, vec nat) -> (ConsumeMessageResponse);
get_messages : () -> (vec OutgoingMessagePair) query;
get_messages : () -> (vec OutgoingMessagePair);
get_nonces : () -> (vec nat) query;
remove_messages : (vec OutgoingMessagePair) -> (ConsumeMessageResponse);
send_message : (principal, vec nat) -> (SendMessageResponse);
Expand Down

0 comments on commit f3a23a1

Please sign in to comment.