aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-04-09 19:06:12 -0400
committerIvan Chen <ivan@tagg.id>2021-04-09 19:23:03 -0400
commit2a9b090ad62c2d157e06c978ba4cbc663f7c550f (patch)
treedaa77483f6630ca7301344601aae0d87e7ed6ae4
parent4d87b32fce89bfd08561d85a3f5440a98131336c (diff)
moved createChannel to messages util
-rw-r--r--src/utils/common.ts18
-rw-r--r--src/utils/messages.ts17
2 files changed, 17 insertions, 18 deletions
diff --git a/src/utils/common.ts b/src/utils/common.ts
index 0900a084..7ae36dc6 100644
--- a/src/utils/common.ts
+++ b/src/utils/common.ts
@@ -173,21 +173,3 @@ const _crestIcon = (university: UniversityType) => {
return require('../assets/images/bwbadges.png');
}
};
-
-export const createChannel = async (
- loggedInUser: string,
- id: string,
- chatClient: any,
-) => {
- console.log(loggedInUser, id, chatClient);
- try {
- const channel = chatClient.channel('messaging', {
- members: [loggedInUser, id],
- });
- await channel.watch();
- return channel;
- } catch (error) {
- console.log(error);
- throw error;
- }
-};
diff --git a/src/utils/messages.ts b/src/utils/messages.ts
index 49033226..dd29f317 100644
--- a/src/utils/messages.ts
+++ b/src/utils/messages.ts
@@ -123,3 +123,20 @@ export const getChatToken = async () => {
console.log(err);
}
};
+
+export const createChannel = async (
+ loggedInUser: string,
+ id: string,
+ chatClient: any,
+) => {
+ try {
+ const channel = chatClient.channel('messaging', {
+ members: [loggedInUser, id],
+ });
+ await channel.watch();
+ return channel;
+ } catch (error) {
+ console.log(error);
+ throw error;
+ }
+};