diff --git a/src/api/auth/auth.js b/src/api/auth/auth.js index dd167d60..646c4c69 100644 --- a/src/api/auth/auth.js +++ b/src/api/auth/auth.js @@ -95,13 +95,6 @@ const checkCurrentSession = async () => { } }; -const loadServiceProviders = async ({ domain }) => { - const baseUrl = '/login'; - const url = `${baseUrl}?domain=${domain}`; - const response = await instance.get(url); - return response; -}; - const clearToken = () => { localStorage.removeItem('access-token'); instance.defaults.headers['X-Webitel-Access'] = ''; @@ -116,7 +109,7 @@ const checkDomainExistence = async (domain) => { const baseUrl = '/login'; const url = `${baseUrl}?domain=${domain}`; try { - await instance.get(url); + return await instance.get(url); } catch (err) { throw err; } @@ -127,7 +120,6 @@ const AuthAPI = { login2fa, register, checkCurrentSession, - loadServiceProviders, checkDomainExistence, }; diff --git a/src/api/instance.js b/src/api/instance.js index d4b983d3..11f011b9 100644 --- a/src/api/instance.js +++ b/src/api/instance.js @@ -71,8 +71,8 @@ instance.interceptors.response.use( type: 'error', text: error.detail || error.response.data.detail, }); - } - return Promise.reject(error.response.data); + } + return Promise.reject(error); }, ); diff --git a/src/components/auth/login/providers/__tests__/the-login-providers.spec.js b/src/components/auth/login/providers/__tests__/the-login-providers.spec.js index 306edd51..e1591a96 100644 --- a/src/components/auth/login/providers/__tests__/the-login-providers.spec.js +++ b/src/components/auth/login/providers/__tests__/the-login-providers.spec.js @@ -29,16 +29,6 @@ describe('TheLoginProviders', () => { expect(wrapper.exists()).toBe(true); }); - it('loads service providers initially', () => { - const mock = vi.spyOn(store, 'dispatch').mockImplementationOnce(vi.fn()); - const wrapper = shallowMount(TheLoginProviders, { - global: { - plugins: [store], - }, - }); - expect(mock).toHaveBeenCalledWith('auth/LOAD_SERVICE_PROVIDERS'); - }); - it('should render service providers', () => { const loginProviders = { [ServiceProvider.ADFS]: {}, diff --git a/src/components/auth/login/providers/the-login-providers.vue b/src/components/auth/login/providers/the-login-providers.vue index ad0b6722..d4c19d43 100644 --- a/src/components/auth/login/providers/the-login-providers.vue +++ b/src/components/auth/login/providers/the-login-providers.vue @@ -50,12 +50,6 @@ const serviceProviders = computed(() => { function openProvider({ ticket }) { return store.dispatch('auth/EXECUTE_PROVIDER', { ticket }); } - -function loadAvailableProviders() { - return store.dispatch('auth/LOAD_SERVICE_PROVIDERS'); -} - -loadAvailableProviders();