Fix typescript issues and bump deps
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
cb96b807a0
commit
a296dbf539
|
@ -59,7 +59,7 @@
|
||||||
"graphql-cli": "^3.0.12",
|
"graphql-cli": "^3.0.12",
|
||||||
"node-sass": "^4.11.0",
|
"node-sass": "^4.11.0",
|
||||||
"patch-package": "^6.1.2",
|
"patch-package": "^6.1.2",
|
||||||
"sass-loader": "^7.1.0",
|
"sass-loader": "^8.0.0",
|
||||||
"tslint": "^5.16.0",
|
"tslint": "^5.16.0",
|
||||||
"tslint-config-airbnb": "^5.11.1",
|
"tslint-config-airbnb": "^5.11.1",
|
||||||
"typescript": "^3.4.3",
|
"typescript": "^3.4.3",
|
||||||
|
|
|
@ -226,7 +226,7 @@ export default class EditIdentity extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
openDeleteIdentityConfirmation() {
|
openDeleteIdentityConfirmation() {
|
||||||
this.$dialog.prompt({
|
this.$buefy.dialog.prompt({
|
||||||
type: 'is-danger',
|
type: 'is-danger',
|
||||||
title: this.$gettext('Delete your identity'),
|
title: this.$gettext('Delete your identity'),
|
||||||
message: this.$gettextInterpolate(
|
message: this.$gettextInterpolate(
|
||||||
|
|
|
@ -289,7 +289,7 @@ export default class Event extends Vue {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
router.push({ name: RouteName.EVENT });
|
await router.push({ name: RouteName.EVENT });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
@ -297,22 +297,25 @@ export default class Event extends Vue {
|
||||||
|
|
||||||
async joinEvent() {
|
async joinEvent() {
|
||||||
try {
|
try {
|
||||||
await this.$apollo.mutate<IParticipant>({
|
await this.$apollo.mutate<{ joinEvent: IParticipant }>({
|
||||||
mutation: JOIN_EVENT,
|
mutation: JOIN_EVENT,
|
||||||
variables: {
|
variables: {
|
||||||
eventId: this.event.id,
|
eventId: this.event.id,
|
||||||
actorId: this.loggedPerson.id,
|
actorId: this.loggedPerson.id,
|
||||||
},
|
},
|
||||||
update: (store, { data: { joinEvent } }) => {
|
update: (store, { data }) => {
|
||||||
const event = store.readQuery<IEvent>({ query: FETCH_EVENT });
|
if (data == null) return;
|
||||||
|
const cachedData = store.readQuery<{ event: IEvent }>({ query: FETCH_EVENT, variables: { uuid: this.event.uuid } });
|
||||||
|
if (cachedData == null) return;
|
||||||
|
const { event } = cachedData;
|
||||||
if (event === null) {
|
if (event === null) {
|
||||||
console.error('Cannot update event participant cache, because of null value.');
|
console.error('Cannot update event participant cache, because of null value.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.participants = event.participants.concat([joinEvent]);
|
event.participants = event.participants.concat([data.joinEvent]);
|
||||||
|
|
||||||
store.writeQuery({ query: FETCH_EVENT, data: event });
|
store.writeQuery({ query: FETCH_EVENT, data: { event } });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -322,23 +325,26 @@ export default class Event extends Vue {
|
||||||
|
|
||||||
async leaveEvent() {
|
async leaveEvent() {
|
||||||
try {
|
try {
|
||||||
await this.$apollo.mutate<IParticipant>({
|
await this.$apollo.mutate<{ leaveEvent: IParticipant }>({
|
||||||
mutation: LEAVE_EVENT,
|
mutation: LEAVE_EVENT,
|
||||||
variables: {
|
variables: {
|
||||||
eventId: this.event.id,
|
eventId: this.event.id,
|
||||||
actorId: this.loggedPerson.id,
|
actorId: this.loggedPerson.id,
|
||||||
},
|
},
|
||||||
update: (store, { data: { leaveEvent } }) => {
|
update: (store, { data }) => {
|
||||||
const event = store.readQuery<IEvent>({ query: FETCH_EVENT });
|
if (data == null) return;
|
||||||
|
const cachedData = store.readQuery<{ event: IEvent }>({ query: FETCH_EVENT, variables: { uuid: this.event.uuid } });
|
||||||
|
if (cachedData == null) return;
|
||||||
|
const { event } = cachedData;
|
||||||
if (event === null) {
|
if (event === null) {
|
||||||
console.error('Cannot update event participant cache, because of null value.');
|
console.error('Cannot update event participant cache, because of null value.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.participants = event.participants
|
event.participants = event.participants
|
||||||
.filter(p => p.actor.id !== leaveEvent.actor.id);
|
.filter(p => p.actor.id !== data.leaveEvent.actor.id);
|
||||||
|
|
||||||
store.writeQuery({ query: FETCH_EVENT, data: event });
|
store.writeQuery({ query: FETCH_EVENT, data: { event } });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -124,20 +124,23 @@ export default class Login extends Vue {
|
||||||
this.errors = [];
|
this.errors = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await this.$apollo.mutate<{ login: ILogin }>({
|
const { data } = await this.$apollo.mutate<{ login: ILogin }>({
|
||||||
mutation: LOGIN,
|
mutation: LOGIN,
|
||||||
variables: {
|
variables: {
|
||||||
email: this.credentials.email,
|
email: this.credentials.email,
|
||||||
password: this.credentials.password,
|
password: this.credentials.password,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
if (data == null) {
|
||||||
|
throw new Error('Data is undefined');
|
||||||
|
}
|
||||||
|
|
||||||
saveUserData(result.data.login);
|
saveUserData(data.login);
|
||||||
|
|
||||||
await this.$apollo.mutate({
|
await this.$apollo.mutate({
|
||||||
mutation: UPDATE_CURRENT_USER_CLIENT,
|
mutation: UPDATE_CURRENT_USER_CLIENT,
|
||||||
variables: {
|
variables: {
|
||||||
id: result.data.login.user.id,
|
id: data.login.user.id,
|
||||||
email: this.credentials.email,
|
email: this.credentials.email,
|
||||||
isLoggedIn: true,
|
isLoggedIn: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -71,16 +71,19 @@ export default class PasswordReset extends Vue {
|
||||||
this.errors.splice(0);
|
this.errors.splice(0);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await this.$apollo.mutate<{ resetPassword: ILogin }>({
|
const { data } = await this.$apollo.mutate<{ resetPassword: ILogin }>({
|
||||||
mutation: RESET_PASSWORD,
|
mutation: RESET_PASSWORD,
|
||||||
variables: {
|
variables: {
|
||||||
password: this.credentials.password,
|
password: this.credentials.password,
|
||||||
token: this.token,
|
token: this.token,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
if (data == null) {
|
||||||
|
throw new Error('Data is undefined');
|
||||||
|
}
|
||||||
|
|
||||||
saveUserData(result.data.resetPassword);
|
saveUserData(data.resetPassword);
|
||||||
this.$router.push({ name: RouteName.HOME });
|
await this.$router.push({ name: RouteName.HOME });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
err.graphQLErrors.forEach(({ message }) => {
|
err.graphQLErrors.forEach(({ message }) => {
|
||||||
|
|
656
js/yarn.lock
656
js/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue