Fix typescript issues and bump deps

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-09-02 18:52:23 +02:00
parent cb96b807a0
commit a296dbf539
6 changed files with 247 additions and 459 deletions

View File

@@ -124,20 +124,23 @@ export default class Login extends Vue {
this.errors = [];
try {
const result = await this.$apollo.mutate<{ login: ILogin }>({
const { data } = await this.$apollo.mutate<{ login: ILogin }>({
mutation: LOGIN,
variables: {
email: this.credentials.email,
password: this.credentials.password,
},
});
if (data == null) {
throw new Error('Data is undefined');
}
saveUserData(result.data.login);
saveUserData(data.login);
await this.$apollo.mutate({
mutation: UPDATE_CURRENT_USER_CLIENT,
variables: {
id: result.data.login.user.id,
id: data.login.user.id,
email: this.credentials.email,
isLoggedIn: true,
},

View File

@@ -71,16 +71,19 @@ export default class PasswordReset extends Vue {
this.errors.splice(0);
try {
const result = await this.$apollo.mutate<{ resetPassword: ILogin }>({
const { data } = await this.$apollo.mutate<{ resetPassword: ILogin }>({
mutation: RESET_PASSWORD,
variables: {
password: this.credentials.password,
token: this.token,
},
});
if (data == null) {
throw new Error('Data is undefined');
}
saveUserData(result.data.resetPassword);
this.$router.push({ name: RouteName.HOME });
saveUserData(data.resetPassword);
await this.$router.push({ name: RouteName.HOME });
} catch (err) {
console.error(err);
err.graphQLErrors.forEach(({ message }) => {