Fix update current client

This commit is contained in:
Chocobozzz
2019-08-21 11:25:09 +02:00
parent 4bc70d5070
commit a353eb49a3
8 changed files with 236 additions and 208 deletions

View File

@@ -14,19 +14,19 @@ export function buildCurrentUserResolver(cache: ApolloCache<NormalizedCacheObjec
});
return {
updateCurrentUser: (_, { id, email, isLoggedIn }, { cache }) => {
const data = {
Mutation: {
Mutation: {
updateCurrentUser: (_, { id, email, isLoggedIn }, { cache }) => {
const data = {
currentUser: {
id,
email,
isLoggedIn,
__typename: 'CurrentUser',
},
},
};
};
cache.writeData({ data });
cache.writeData({ data });
},
},
};
}

View File

@@ -7,6 +7,7 @@ mutation Login($email: String!, $password: String!) {
refreshToken,
user {
id,
email
}
},
}
@@ -21,7 +22,8 @@ mutation SendResetPassword($email: String!) {
export const RESET_PASSWORD = gql`
mutation ResetPassword($token: String!, $password: String!) {
resetPassword(token: $token, password: $password) {
token,
accessToken,
refreshToken
user {
id,
}

View File

@@ -225,7 +225,7 @@ export default class EditIdentity extends Vue {
}
openDeleteIdentityConfirmation() {
this.$dialog.prompt({
this.$buefy.dialog.prompt({
type: 'is-danger',
title: this.$gettext('Delete your identity'),
message: this.$gettextInterpolate(

View File

@@ -146,9 +146,9 @@ export default class Login extends Vue {
onLogin(this.$apollo);
if (this.redirect) {
this.$router.push(this.redirect);
await this.$router.push(this.redirect);
} else {
this.$router.push({ name: RouteName.HOME });
await this.$router.push({ name: RouteName.HOME });
}
} catch (err) {
console.error(err);

View File

@@ -107,9 +107,7 @@ const apolloClient = new ApolloClient({
cache,
link,
connectToDevTools: true,
resolvers: {
currentUser: buildCurrentUserResolver(cache),
},
resolvers: buildCurrentUserResolver(cache)
});
export const apolloProvider = new VueApollo({