forked from potsda.mn/mobilizon
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",
|
||||
"node-sass": "^4.11.0",
|
||||
"patch-package": "^6.1.2",
|
||||
"sass-loader": "^7.1.0",
|
||||
"sass-loader": "^8.0.0",
|
||||
"tslint": "^5.16.0",
|
||||
"tslint-config-airbnb": "^5.11.1",
|
||||
"typescript": "^3.4.3",
|
||||
|
|
|
@ -226,7 +226,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(
|
||||
|
|
|
@ -289,7 +289,7 @@ export default class Event extends Vue {
|
|||
},
|
||||
});
|
||||
|
||||
router.push({ name: RouteName.EVENT });
|
||||
await router.push({ name: RouteName.EVENT });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -297,22 +297,25 @@ export default class Event extends Vue {
|
|||
|
||||
async joinEvent() {
|
||||
try {
|
||||
await this.$apollo.mutate<IParticipant>({
|
||||
await this.$apollo.mutate<{ joinEvent: IParticipant }>({
|
||||
mutation: JOIN_EVENT,
|
||||
variables: {
|
||||
eventId: this.event.id,
|
||||
actorId: this.loggedPerson.id,
|
||||
},
|
||||
update: (store, { data: { joinEvent } }) => {
|
||||
const event = store.readQuery<IEvent>({ query: FETCH_EVENT });
|
||||
update: (store, { data }) => {
|
||||
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) {
|
||||
console.error('Cannot update event participant cache, because of null value.');
|
||||
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) {
|
||||
|
@ -322,23 +325,26 @@ export default class Event extends Vue {
|
|||
|
||||
async leaveEvent() {
|
||||
try {
|
||||
await this.$apollo.mutate<IParticipant>({
|
||||
await this.$apollo.mutate<{ leaveEvent: IParticipant }>({
|
||||
mutation: LEAVE_EVENT,
|
||||
variables: {
|
||||
eventId: this.event.id,
|
||||
actorId: this.loggedPerson.id,
|
||||
},
|
||||
update: (store, { data: { leaveEvent } }) => {
|
||||
const event = store.readQuery<IEvent>({ query: FETCH_EVENT });
|
||||
update: (store, { data }) => {
|
||||
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) {
|
||||
console.error('Cannot update event participant cache, because of null value.');
|
||||
return;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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 }) => {
|
||||
|
|
656
js/yarn.lock
656
js/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue