Revert "Use GraphQL for email available"

This reverts commit 24cccbf053.
This commit is contained in:
Christian Cueni 2020-03-17 13:29:40 +01:00
parent 24cccbf053
commit 9617a1ee88
8 changed files with 23 additions and 83 deletions

View File

@ -3292,11 +3292,6 @@
"tslib": "^1.9.3"
}
},
"apollo-link-rest": {
"version": "0.7.3",
"resolved": "https://registry.npmjs.org/apollo-link-rest/-/apollo-link-rest-0.7.3.tgz",
"integrity": "sha512-Cu60ZO/7de9preDsH3N3zHL40mrMfwgGbxPDdDEqRbes1Ms+DSRqBMv5yB641dSjSeZHKQW1ikQwc8GA8dBJKA=="
},
"apollo-utilities": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/apollo-utilities/-/apollo-utilities-1.3.3.tgz",
@ -9756,31 +9751,6 @@
"iterall": "^1.2.1"
}
},
"graphql-anywhere": {
"version": "4.2.6",
"resolved": "https://registry.npmjs.org/graphql-anywhere/-/graphql-anywhere-4.2.6.tgz",
"integrity": "sha512-re4fqaii3l0fCsC3qFKQrmwffephI9rinrwXAy+4EnWip2YkGlV8wC4en42eW8KI2nlWBh9lkJPfR/5TZf/l1w==",
"requires": {
"apollo-utilities": "^1.3.3",
"ts-invariant": "^0.3.2",
"tslib": "^1.10.0"
},
"dependencies": {
"ts-invariant": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.3.3.tgz",
"integrity": "sha512-UReOKsrJFGC9tUblgSRWo+BsVNbEd77Cl6WiV/XpMlkifXwNIJbknViCucHvVZkXSC/mcWeRnIGdY7uprcwvdQ==",
"requires": {
"tslib": "^1.9.3"
}
},
"tslib": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
"integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA=="
}
}
},
"graphql-tag": {
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.10.1.tgz",

View File

@ -27,7 +27,6 @@
"apollo-link": "^1.2.13",
"apollo-link-error": "^1.1.12",
"apollo-link-http": "^1.5.16",
"apollo-link-rest": "^0.7.3",
"appolo": "^6.0.19",
"autoprefixer": "^7.1.2",
"axios": "^0.18.0",
@ -53,7 +52,6 @@
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"graphql": "^0.13.2",
"graphql-anywhere": "^4.2.6",
"graphql-tag": "^2.10.1",
"html-webpack-plugin": "^2.30.1",
"lodash": "^4.17.10",

View File

@ -3,7 +3,6 @@ import {createHttpLink} from 'apollo-link-http'
import {onError} from 'apollo-link-error';
import {ApolloClient} from 'apollo-client'
import {ApolloLink, Observable} from 'apollo-link'
import {RestLink} from 'apollo-link-rest';
import fetch from 'unfetch'
import {typeDefs} from '@/graphql/typedefs';
import {resolvers} from '@/graphql/resolvers';
@ -19,21 +18,6 @@ export default function (uri, networkErrorCallback) {
}
});
const restLink = new RestLink(
{
uri: 'https://stage.hep-verlag.ch',
responseTransformer: async (response, typename) => response.text().then(text => {
if (typename === 'EmailAvailable') {
return {
__typename: typename,
isAvailable: text === 'true'
};
} else {
return text;
}
})
}
); // todo: use env variable
const consoleLink = new ApolloLink((operation, forward) => {
// console.log(`starting request for ${operation.operationName}`);
@ -80,7 +64,7 @@ export default function (uri, networkErrorCallback) {
}
});
const composedLink = ApolloLink.from([createOmitTypenameLink, consoleLink, errorLink, restLink, httpLink]);
const composedLink = ApolloLink.from([createOmitTypenameLink, consoleLink, errorLink, httpLink]);
const cache = new InMemoryCache({
dataIdFromObject: obj => {

View File

@ -1,6 +0,0 @@
query IsEmailAvailable($input: String!) {
isEmailAvailable(input: $input) @rest(type: "EmailAvailable", path: "/rest/deutsch/V1/customers/isEmailAvailable", method: "POST") {
isAvailable
}
}

View File

@ -1,6 +0,0 @@
query IsEmailAvailable($input: String!) {
isEmailAvailable(input: $input) @rest(type: "isEmailAvailable", path: "/rest/deutsch/V1/customers/isEmailAvailable", methods: "POST") {
isAvailable
}
}

View File

@ -9,3 +9,10 @@ export function register(registrationData) {
export function login(username, password) {
return axios.post(`${hepBaseUrl}/rest/deutsch/V1/integration/customer/token`, {username, password});
}
export function emailExists(email) {
return axios.post(`${hepBaseUrl}/rest/deutsch/V1/customers/isEmailAvailable`, {
customerEmail: email,
websiteId: 1
});
}

View File

@ -4,7 +4,7 @@
<h1 class="forgot-password__title public-page__title" data-cy="forgot-password">Passwort vergessen?</h1>
</header>
<section class="forgot-password__section forgot-password__text">
<p class="forgot-info">Ihr Benutzerkonto wird durch den Hep Verlag verwaltet und deshalb können Sie das Passwort ausschliesslich auf
<p class="forgot-info">Ihr Benutzerkonto wird durch den Hep Verlag verwaltet und deshalb können Sie das Passwort ausschliesslicht auf
<a class="noserif-link" href="https://www.hep-verlag.ch">www.hep-verlag.ch</a> verwaltet werden.</p>
<p class="forgot-info">Melden Sie sich mit der gleichen E-Mail-Adresse und dem gleichen </p>
</section>
@ -14,6 +14,7 @@
</div>
</template>
<style scoped lang="scss">
@import "@/styles/_variables.scss";
@import "@/styles/_mixins.scss";

View File

@ -35,7 +35,6 @@
import {emailExists} from '../hep-client/index';
import HELLO_EMAIL_MUTATION from '@/graphql/gql/local/mutations/helloEmail.gql';
import IS_EMAIL_AVAILABLE_QUERY from '@/graphql/gql/rest/isEmailAvailableQuery.gql';
export default {
components: {},
@ -45,17 +44,10 @@ export default {
this.$validator.validate().then(result => {
this.submitted = true;
if (result) {
this.$apollo.query({
query: IS_EMAIL_AVAILABLE_QUERY,
variables: {
input: {
customerEmail: this.email,
websiteId: 1
}
}
}).then(({data}) => {
emailExists(this.email).then((response) => {
let redirectRouteName = 'login';
if (data.isEmailAvailable.isAvailable) {
if (response.data) {
redirectRouteName = 'registration';
}