aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-11-08 15:42:55 -0300
committerSebastian <sebasjm@gmail.com>2021-11-08 15:42:55 -0300
commit8481aadfd9f413620a5d16bc1e3144e1126e4839 (patch)
treef98d3879f8352f40178486f4eb7918cf927638d3
parentc898eae296b21e7ca3be7b2fd524d639f492b337 (diff)
fix method type check
-rw-r--r--packages/anastasis-webui/src/pages/home/AddingProviderScreen.stories.tsx6
-rw-r--r--packages/anastasis-webui/src/pages/home/AddingProviderScreen.tsx3
2 files changed, 7 insertions, 2 deletions
diff --git a/packages/anastasis-webui/src/pages/home/AddingProviderScreen.stories.tsx b/packages/anastasis-webui/src/pages/home/AddingProviderScreen.stories.tsx
index 60261bd0d..a96734caa 100644
--- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen.stories.tsx
+++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen.stories.tsx
@@ -40,7 +40,11 @@ export const NewProvider = createExample(TestedComponent, {
...reducerStatesExample.authEditing,
} as ReducerState);
-export const NewSMSProvider = createExample(TestedComponent, {
+export const NewVideoProvider = createExample(TestedComponent, {
+ ...reducerStatesExample.authEditing,
+} as ReducerState, { providerType: 'video'});
+
+export const NewSmsProvider = createExample(TestedComponent, {
...reducerStatesExample.authEditing,
} as ReducerState, { providerType: 'sms'});
diff --git a/packages/anastasis-webui/src/pages/home/AddingProviderScreen.tsx b/packages/anastasis-webui/src/pages/home/AddingProviderScreen.tsx
index d2d22374e..5cf6fbb09 100644
--- a/packages/anastasis-webui/src/pages/home/AddingProviderScreen.tsx
+++ b/packages/anastasis-webui/src/pages/home/AddingProviderScreen.tsx
@@ -19,12 +19,13 @@ async function testProvider(url: string, expectedMethodType?: string): Promise<v
if (!("methods" in json) || !Array.isArray(json.methods)) {
throw Error("This provider doesn't have authentication method. Check the provider URL")
}
+ console.log("expected", expectedMethodType)
if (!expectedMethodType) {
return
}
let found = false
for (let i = 0; i < json.methods.length && !found; i++) {
- found = json.methods[i].type !== expectedMethodType
+ found = json.methods[i].type === expectedMethodType
}
if (!found) {
throw Error(`This provider does not support authentication method ${expectedMethodType}`)