aboutsummaryrefslogtreecommitdiff
path: root/src/utils/common.ts
diff options
context:
space:
mode:
authorAshm Walia <40498934+ashmgarv@users.noreply.github.com>2020-11-10 16:28:15 -0800
committerGitHub <noreply@github.com>2020-11-10 19:28:15 -0500
commit3362da273a4ffcc7d6362278bcb9fd919deda2b9 (patch)
tree6df5f6a0585fc327b0f378851f770b6d31aefebe /src/utils/common.ts
parent9f048868f560dbd1672c1a504deb383ec601589e (diff)
[TMA - 388] Block Users (Frontend) (#115)
* initial * Final * sc * sc * sall change * Remove follow button when blocked * Small change * small changes again
Diffstat (limited to 'src/utils/common.ts')
-rw-r--r--src/utils/common.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utils/common.ts b/src/utils/common.ts
new file mode 100644
index 00000000..9e74ca33
--- /dev/null
+++ b/src/utils/common.ts
@@ -0,0 +1,15 @@
+import {TOGGLE_BUTTON_TYPE} from '../constants';
+
+export const getToggleButtonText: (
+ button_type: string,
+ state: boolean,
+) => string | null = (button_type, state) => {
+ switch (button_type) {
+ case TOGGLE_BUTTON_TYPE.FOLLOW_UNFOLLOW:
+ return state ? 'Unfollow' : 'Follow';
+ case TOGGLE_BUTTON_TYPE.BLOCK_UNBLOCK:
+ return state ? 'Unblock' : 'Block';
+ default:
+ return null;
+ }
+};