@@ -46,19 +46,19 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-property-decorator";
|
||||
import { IDENTITIES, LOGGED_PERSON, CREATE_PERSON } from "../../graphql/actor";
|
||||
import { IPerson } from "@/types/actor.model";
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import { IDENTITIES, LOGGED_PERSON, CREATE_PERSON } from '../../graphql/actor';
|
||||
import { IPerson } from '@/types/actor.model';
|
||||
|
||||
@Component({
|
||||
apollo: {
|
||||
identities: {
|
||||
query: IDENTITIES
|
||||
query: IDENTITIES,
|
||||
},
|
||||
loggedPerson: {
|
||||
query: LOGGED_PERSON
|
||||
}
|
||||
}
|
||||
query: LOGGED_PERSON,
|
||||
},
|
||||
},
|
||||
})
|
||||
export default class Identities extends Vue {
|
||||
identities: IPerson[] = [];
|
||||
@@ -73,7 +73,7 @@ export default class Identities extends Vue {
|
||||
try {
|
||||
await this.$apollo.mutate({
|
||||
mutation: CREATE_PERSON,
|
||||
variables: this.newPerson
|
||||
variables: this.newPerson,
|
||||
});
|
||||
this.showCreateProfileForm = false;
|
||||
this.$apollo.queries.identities.refresh();
|
||||
|
||||
@@ -66,10 +66,10 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { FETCH_PERSON, LOGGED_PERSON } from "@/graphql/actor";
|
||||
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
||||
import EventCard from "@/components/Event/EventCard.vue";
|
||||
import { RouteName } from '@/router'
|
||||
import { FETCH_PERSON, LOGGED_PERSON } from '@/graphql/actor';
|
||||
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
|
||||
import EventCard from '@/components/Event/EventCard.vue';
|
||||
import { RouteName } from '@/router';
|
||||
|
||||
@Component({
|
||||
apollo: {
|
||||
@@ -77,17 +77,17 @@ import { RouteName } from '@/router'
|
||||
query: FETCH_PERSON,
|
||||
variables() {
|
||||
return {
|
||||
name: this.$route.params.name
|
||||
name: this.$route.params.name,
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
loggedPerson: {
|
||||
query: LOGGED_PERSON
|
||||
}
|
||||
query: LOGGED_PERSON,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
EventCard
|
||||
}
|
||||
EventCard,
|
||||
},
|
||||
})
|
||||
export default class Profile extends Vue {
|
||||
@Prop({ type: String, required: true }) name!: string;
|
||||
@@ -95,7 +95,7 @@ export default class Profile extends Vue {
|
||||
person = null;
|
||||
|
||||
// call again the method if the route changes
|
||||
@Watch("$route")
|
||||
@Watch('$route')
|
||||
onRouteChange() {
|
||||
// this.fetchData()
|
||||
}
|
||||
@@ -106,7 +106,7 @@ export default class Profile extends Vue {
|
||||
}
|
||||
|
||||
nl2br(text) {
|
||||
return text.replace(/(?:\r\n|\r|\n)/g, "<br>");
|
||||
return text.replace(/(?:\r\n|\r|\n)/g, '<br>');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -70,11 +70,11 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { IPerson } from "@/types/actor.model";
|
||||
import { REGISTER_PERSON } from "@/graphql/actor";
|
||||
import { MOBILIZON_INSTANCE_HOST } from "@/api/_entrypoint";
|
||||
import { RouteName } from '@/router'
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { IPerson } from '@/types/actor.model';
|
||||
import { REGISTER_PERSON } from '@/graphql/actor';
|
||||
import { MOBILIZON_INSTANCE_HOST } from '@/api/_entrypoint';
|
||||
import { RouteName } from '@/router';
|
||||
|
||||
@Component
|
||||
export default class Register extends Vue {
|
||||
@@ -104,7 +104,7 @@ export default class Register extends Vue {
|
||||
this.errors = {};
|
||||
await this.$apollo.mutate({
|
||||
mutation: REGISTER_PERSON,
|
||||
variables: Object.assign({ email: this.email }, this.person)
|
||||
variables: Object.assign({ email: this.email }, this.person),
|
||||
});
|
||||
this.validationSent = true;
|
||||
|
||||
@@ -115,7 +115,7 @@ export default class Register extends Vue {
|
||||
this.errors = error.graphQLErrors.reduce((acc, error) => {
|
||||
acc[error.details] = error.message;
|
||||
return acc;
|
||||
}, {});
|
||||
}, {});
|
||||
console.error(error);
|
||||
console.error(this.errors);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<b-input aria-required="true" required v-model="event.title"/>
|
||||
</b-field>
|
||||
|
||||
<b-datepicker v-model="event.begins_on" inline></b-datepicker>
|
||||
<b-datepicker v-model="event.beginsOn" inline></b-datepicker>
|
||||
|
||||
<b-field :label="$gettext('Category')">
|
||||
<b-select placeholder="Select a category" v-model="event.category">
|
||||
@@ -31,23 +31,23 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
// import Location from '@/components/Location';
|
||||
import {CREATE_EVENT, EDIT_EVENT} from "@/graphql/event";
|
||||
import {Component, Prop, Vue} from "vue-property-decorator";
|
||||
import {
|
||||
// import Location from '@/components/Location';
|
||||
import { CREATE_EVENT, EDIT_EVENT } from '@/graphql/event';
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import {
|
||||
Category,
|
||||
IEvent,
|
||||
EventModel,
|
||||
} from "@/types/event.model";
|
||||
import {LOGGED_PERSON} from "@/graphql/actor";
|
||||
import {IPerson, Person} from "@/types/actor.model";
|
||||
} from '@/types/event.model';
|
||||
import { LOGGED_PERSON } from '@/graphql/actor';
|
||||
import { IPerson, Person } from '@/types/actor.model';
|
||||
|
||||
@Component({
|
||||
apollo: {
|
||||
loggedPerson: {
|
||||
query: LOGGED_PERSON,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
export default class CreateEvent extends Vue {
|
||||
@Prop({ required: false, type: String }) uuid!: string;
|
||||
@@ -61,23 +61,23 @@ export default class CreateEvent extends Vue {
|
||||
this.event.organizerActor = this.loggedPerson;
|
||||
this.event.attributedTo = this.loggedPerson;
|
||||
|
||||
if (this.event.uuid === "") {
|
||||
if (this.event.uuid === '') {
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: CREATE_EVENT,
|
||||
variables: {
|
||||
title: this.event.title,
|
||||
description: this.event.description,
|
||||
beginsOn: this.event.begins_on,
|
||||
beginsOn: this.event.beginsOn,
|
||||
category: this.event.category,
|
||||
organizerActorId: this.event.organizerActor.id
|
||||
}
|
||||
organizerActorId: this.event.organizerActor.id,
|
||||
},
|
||||
})
|
||||
.then(data => {
|
||||
console.log("event created", data);
|
||||
console.log('event created', data);
|
||||
this.$router.push({
|
||||
name: "Event",
|
||||
params: { uuid: data.data.createEvent.uuid }
|
||||
name: 'Event',
|
||||
params: { uuid: data.data.createEvent.uuid },
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
@@ -86,12 +86,12 @@ export default class CreateEvent extends Vue {
|
||||
} else {
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: EDIT_EVENT
|
||||
mutation: EDIT_EVENT,
|
||||
})
|
||||
.then(data => {
|
||||
this.$router.push({
|
||||
name: "Event",
|
||||
params: { uuid: data.data.uuid }
|
||||
name: 'Event',
|
||||
params: { uuid: data.data.uuid },
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</figure>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<span>{{ event.begins_on | formatDay }}</span>
|
||||
<span>{{ event.beginsOn | formatDay }}</span>
|
||||
<span class="tag is-primary">{{ event.category }}</span>
|
||||
<h1 class="title">{{ event.title }}</h1>
|
||||
<router-link
|
||||
@@ -44,7 +44,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<span>{{ event.begins_on | formatDate }} - {{ event.ends_on | formatDate }}</span>
|
||||
<span>{{ event.beginsOn | formatDate }} - {{ event.endsOn | formatDate }}</span>
|
||||
</div>
|
||||
<p v-if="actorIsOrganizer()">
|
||||
<translate>You are an organizer.</translate>
|
||||
@@ -100,11 +100,10 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { DELETE_EVENT, FETCH_EVENT, LEAVE_EVENT } from '@/graphql/event';
|
||||
import { DELETE_EVENT, FETCH_EVENT, JOIN_EVENT, LEAVE_EVENT } from '@/graphql/event';
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { LOGGED_PERSON } from '@/graphql/actor';
|
||||
import { IEvent, IParticipant } from '@/types/event.model';
|
||||
import { JOIN_EVENT } from '@/graphql/event';
|
||||
import { IPerson } from '@/types/actor.model';
|
||||
import { RouteName } from '@/router';
|
||||
import 'vue-simple-markdown/dist/vue-simple-markdown.css';
|
||||
@@ -115,14 +114,14 @@ import 'vue-simple-markdown/dist/vue-simple-markdown.css';
|
||||
query: FETCH_EVENT,
|
||||
variables() {
|
||||
return {
|
||||
uuid: this.uuid
|
||||
uuid: this.uuid,
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
loggedPerson: {
|
||||
query: LOGGED_PERSON
|
||||
}
|
||||
}
|
||||
query: LOGGED_PERSON,
|
||||
},
|
||||
},
|
||||
})
|
||||
export default class Event extends Vue {
|
||||
@Prop({ type: String, required: true }) uuid!: string;
|
||||
@@ -140,10 +139,10 @@ export default class Event extends Vue {
|
||||
variables: {
|
||||
id: this.event.id,
|
||||
actorId: this.loggedPerson.id,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
router.push({ name: RouteName.EVENT })
|
||||
router.push({ name: RouteName.EVENT });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
@@ -161,13 +160,13 @@ export default class Event extends Vue {
|
||||
const event = store.readQuery<IEvent>({ query: FETCH_EVENT });
|
||||
if (event === null) {
|
||||
console.error('Cannot update event participant cache, because of null value.');
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
event.participants = event.participants.concat([ joinEvent ]);
|
||||
event.participants = event.participants.concat([joinEvent]);
|
||||
|
||||
store.writeQuery({ query: FETCH_EVENT, data: event });
|
||||
}
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -186,14 +185,14 @@ export default class Event extends Vue {
|
||||
const event = store.readQuery<IEvent>({ query: FETCH_EVENT });
|
||||
if (event === null) {
|
||||
console.error('Cannot update event participant cache, because of null value.');
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
event.participants = event.participants
|
||||
.filter(p => p.actor.id !== leaveEvent.actor.id);
|
||||
|
||||
store.writeQuery({ query: FETCH_EVENT, data: event });
|
||||
}
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
@@ -27,8 +27,8 @@ const ngeohash = require('ngeohash');
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
EventCard
|
||||
}
|
||||
EventCard,
|
||||
},
|
||||
})
|
||||
export default class EventList extends Vue {
|
||||
@Prop(String) location!: string;
|
||||
@@ -39,7 +39,7 @@ export default class EventList extends Vue {
|
||||
locationText = '';
|
||||
|
||||
created() {
|
||||
this.fetchData(this.$router.currentRoute.params["location"]);
|
||||
this.fetchData(this.$router.currentRoute.params['location']);
|
||||
}
|
||||
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
@@ -47,7 +47,7 @@ export default class EventList extends Vue {
|
||||
next();
|
||||
}
|
||||
|
||||
@Watch("locationChip")
|
||||
@Watch('locationChip')
|
||||
onLocationChipChange(val) {
|
||||
if (val === false) {
|
||||
this.$router.push({ name: RouteName.EVENT_LIST });
|
||||
@@ -61,7 +61,7 @@ export default class EventList extends Vue {
|
||||
}
|
||||
|
||||
fetchData(location) {
|
||||
let queryString = "/events";
|
||||
let queryString = '/events';
|
||||
if (location) {
|
||||
queryString += `?geohash=${location}`;
|
||||
const { latitude, longitude } = ngeohash.decode(location);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-property-decorator";
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
|
||||
@Component({})
|
||||
export default class CreateGroup extends Vue {
|
||||
@@ -74,13 +74,13 @@ export default class CreateGroup extends Vue {
|
||||
this.group.address = {
|
||||
geo: {
|
||||
latitude: addressData.latitude,
|
||||
longitude: addressData.longitude
|
||||
longitude: addressData.longitude,
|
||||
},
|
||||
addressCountry: addressData.country,
|
||||
addressLocality: addressData.city,
|
||||
addressRegion: addressData.administrative_area_level_1,
|
||||
postalCode: addressData.postal_code,
|
||||
streetAddress: `${addressData.street_number} ${addressData.route}`
|
||||
streetAddress: `${addressData.street_number} ${addressData.route}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
||||
import EventCard from "@/components/Event/EventCard.vue";
|
||||
import { FETCH_PERSON, LOGGED_PERSON } from "@/graphql/actor";
|
||||
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
|
||||
import EventCard from '@/components/Event/EventCard.vue';
|
||||
import { FETCH_PERSON, LOGGED_PERSON } from '@/graphql/actor';
|
||||
|
||||
@Component({
|
||||
apollo: {
|
||||
@@ -70,17 +70,17 @@ import { FETCH_PERSON, LOGGED_PERSON } from "@/graphql/actor";
|
||||
query: FETCH_PERSON,
|
||||
variables() {
|
||||
return {
|
||||
name: this.$route.params.name
|
||||
name: this.$route.params.name,
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
loggedPerson: {
|
||||
query: LOGGED_PERSON
|
||||
}
|
||||
query: LOGGED_PERSON,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
EventCard
|
||||
}
|
||||
EventCard,
|
||||
},
|
||||
})
|
||||
export default class Group extends Vue {
|
||||
@Prop({ type: String, required: true }) name!: string;
|
||||
@@ -92,7 +92,7 @@ export default class Group extends Vue {
|
||||
this.fetchData();
|
||||
}
|
||||
|
||||
@Watch("$route")
|
||||
@Watch('$route')
|
||||
onRouteChanged() {
|
||||
// call again the method if the route changes
|
||||
this.fetchData();
|
||||
|
||||
@@ -32,7 +32,7 @@ export default class GroupList extends Vue {
|
||||
}
|
||||
|
||||
usernameWithDomain(actor) {
|
||||
return actor.username + (actor.domain === null ? "" : `@${actor.domain}`);
|
||||
return actor.username + (actor.domain === null ? '' : `@${actor.domain}`);
|
||||
}
|
||||
|
||||
fetchData() {
|
||||
@@ -57,7 +57,7 @@ export default class GroupList extends Vue {
|
||||
viewActor(actor) {
|
||||
this.$router.push({
|
||||
name: RouteName.GROUP,
|
||||
params: { name: this.usernameWithDomain(actor) }
|
||||
params: { name: this.usernameWithDomain(actor) },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -51,25 +51,20 @@ import { RouteName } from '@/router';
|
||||
apollo: {
|
||||
events: {
|
||||
query: FETCH_EVENTS,
|
||||
fetchPolicy: "no-cache" // Debug me: https://github.com/apollographql/apollo-client/issues/3030
|
||||
fetchPolicy: 'no-cache', // Debug me: https://github.com/apollographql/apollo-client/issues/3030
|
||||
},
|
||||
loggedPerson: {
|
||||
query: LOGGED_PERSON
|
||||
query: LOGGED_PERSON,
|
||||
},
|
||||
currentUser: {
|
||||
query: CURRENT_USER_CLIENT
|
||||
}
|
||||
query: CURRENT_USER_CLIENT,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
EventCard
|
||||
}
|
||||
EventCard,
|
||||
},
|
||||
})
|
||||
export default class Home extends Vue {
|
||||
searchTerm = null;
|
||||
location_field = {
|
||||
loading: false,
|
||||
search: null
|
||||
};
|
||||
events = [];
|
||||
locations = [];
|
||||
city = { name: null };
|
||||
@@ -124,9 +119,9 @@ export default class Home extends Vue {
|
||||
const geoHash = ngeohash.encode(
|
||||
addressData.latitude,
|
||||
addressData.longitude,
|
||||
11
|
||||
11,
|
||||
);
|
||||
sessionStorage.setItem("City", geoHash);
|
||||
sessionStorage.setItem('City', geoHash);
|
||||
|
||||
this.$router.push({ name: RouteName.EVENT_LIST, params: { location: geoHash } });
|
||||
}
|
||||
|
||||
@@ -3,28 +3,28 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
|
||||
@Component
|
||||
export default class Location extends Vue {
|
||||
@Prop(String) address!: string;
|
||||
|
||||
description = "Paris, France";
|
||||
description = 'Paris, France';
|
||||
center = { lat: 48.85, lng: 2.35 };
|
||||
markers: any[] = [];
|
||||
|
||||
setPlace(place) {
|
||||
this.center = {
|
||||
lat: place.geometry.location.lat(),
|
||||
lng: place.geometry.location.lng()
|
||||
lng: place.geometry.location.lng(),
|
||||
};
|
||||
this.markers = [
|
||||
{
|
||||
position: { lat: this.center.lat, lng: this.center.lng }
|
||||
}
|
||||
position: { lat: this.center.lat, lng: this.center.lng },
|
||||
},
|
||||
];
|
||||
|
||||
this.$emit("input", place.formatted_address);
|
||||
this.$emit('input', place.formatted_address);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -53,29 +53,29 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { LOGIN } from "@/graphql/auth";
|
||||
import { validateEmailField, validateRequiredField } from "@/utils/validators";
|
||||
import { saveUserData } from "@/utils/auth";
|
||||
import { ILogin } from "@/types/login.model";
|
||||
import { UPDATE_CURRENT_USER_CLIENT } from "@/graphql/user";
|
||||
import { onLogin } from "@/vue-apollo";
|
||||
import { RouteName } from '@/router'
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { LOGIN } from '@/graphql/auth';
|
||||
import { validateEmailField, validateRequiredField } from '@/utils/validators';
|
||||
import { saveUserData } from '@/utils/auth';
|
||||
import { ILogin } from '@/types/login.model';
|
||||
import { UPDATE_CURRENT_USER_CLIENT } from '@/graphql/user';
|
||||
import { onLogin } from '@/vue-apollo';
|
||||
import { RouteName } from '@/router';
|
||||
|
||||
@Component
|
||||
export default class Login extends Vue {
|
||||
@Prop({ type: String, required: false, default: "" }) email!: string;
|
||||
@Prop({ type: String, required: false, default: "" }) password!: string;
|
||||
@Prop({ type: String, required: false, default: '' }) email!: string;
|
||||
@Prop({ type: String, required: false, default: '' }) password!: string;
|
||||
|
||||
credentials = {
|
||||
email: "",
|
||||
password: ""
|
||||
email: '',
|
||||
password: '',
|
||||
};
|
||||
validationSent = false;
|
||||
errors: string[] = [];
|
||||
rules = {
|
||||
required: validateRequiredField,
|
||||
email: validateEmailField
|
||||
email: validateEmailField,
|
||||
};
|
||||
user: any;
|
||||
|
||||
@@ -99,8 +99,8 @@ export default class Login extends Vue {
|
||||
mutation: LOGIN,
|
||||
variables: {
|
||||
email: this.credentials.email,
|
||||
password: this.credentials.password
|
||||
}
|
||||
password: this.credentials.password,
|
||||
},
|
||||
});
|
||||
|
||||
saveUserData(result.data.login);
|
||||
@@ -109,8 +109,8 @@ export default class Login extends Vue {
|
||||
mutation: UPDATE_CURRENT_USER_CLIENT,
|
||||
variables: {
|
||||
id: result.data.login.user.id,
|
||||
email: this.credentials.email
|
||||
}
|
||||
email: this.credentials.email,
|
||||
},
|
||||
});
|
||||
|
||||
onLogin(this.$apollo);
|
||||
|
||||
@@ -35,28 +35,28 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { validateRequiredField } from "@/utils/validators";
|
||||
import { RESET_PASSWORD } from "@/graphql/auth";
|
||||
import { saveUserData } from "@/utils/auth";
|
||||
import { ILogin } from "@/types/login.model";
|
||||
import { RouteName } from '@/router'
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { validateRequiredField } from '@/utils/validators';
|
||||
import { RESET_PASSWORD } from '@/graphql/auth';
|
||||
import { saveUserData } from '@/utils/auth';
|
||||
import { ILogin } from '@/types/login.model';
|
||||
import { RouteName } from '@/router';
|
||||
|
||||
@Component
|
||||
export default class PasswordReset extends Vue {
|
||||
@Prop({ type: String, required: true }) token!: string;
|
||||
|
||||
credentials = {
|
||||
password: "",
|
||||
password_confirmation: ""
|
||||
password: '',
|
||||
password_confirmation: '',
|
||||
} as { password: string; password_confirmation: string };
|
||||
errors: string[] = [];
|
||||
rules = {
|
||||
password_length: value =>
|
||||
value.length > 6 || "Password must be at least 6 characters long",
|
||||
password_length: (value: string) =>
|
||||
value.length > 6 || 'Password must be at least 6 characters long',
|
||||
required: validateRequiredField,
|
||||
password_equal: value =>
|
||||
value === this.credentials.password || "Passwords must be the same"
|
||||
password_equal: (value: string) =>
|
||||
value === this.credentials.password || 'Passwords must be the same',
|
||||
};
|
||||
|
||||
get samePasswords() {
|
||||
@@ -75,8 +75,8 @@ export default class PasswordReset extends Vue {
|
||||
mutation: RESET_PASSWORD,
|
||||
variables: {
|
||||
password: this.credentials.password,
|
||||
token: this.token
|
||||
}
|
||||
token: this.token,
|
||||
},
|
||||
});
|
||||
|
||||
saveUserData(result.data.resetPassword);
|
||||
|
||||
@@ -108,19 +108,19 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { CREATE_USER } from "@/graphql/user";
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { UserRouteName } from '@/router/user'
|
||||
import { CREATE_USER } from '@/graphql/user';
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { UserRouteName } from '@/router/user';
|
||||
|
||||
@Component
|
||||
export default class Register extends Vue {
|
||||
@Prop({ type: String, required: false, default: "" }) email!: string;
|
||||
@Prop({ type: String, required: false, default: "" }) password!: string;
|
||||
@Prop({ type: String, required: false, default: '' }) email!: string;
|
||||
@Prop({ type: String, required: false, default: '' }) password!: string;
|
||||
|
||||
credentials = {
|
||||
email: this.email,
|
||||
password: this.password
|
||||
}
|
||||
password: this.password,
|
||||
};
|
||||
errors: object = {};
|
||||
sendingValidation: boolean = false;
|
||||
validationSent: boolean = false;
|
||||
@@ -132,21 +132,21 @@ export default class Register extends Vue {
|
||||
|
||||
await this.$apollo.mutate({
|
||||
mutation: CREATE_USER,
|
||||
variables: this.credentials
|
||||
variables: this.credentials,
|
||||
});
|
||||
|
||||
this.validationSent = true;
|
||||
|
||||
this.$router.push({
|
||||
name: UserRouteName.REGISTER_PROFILE,
|
||||
params: { email: this.credentials.email }
|
||||
params: { email: this.credentials.email },
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
this.errors = error.graphQLErrors.reduce((acc, error) => {
|
||||
acc[error.details] = error.message;
|
||||
return acc;
|
||||
}, {});
|
||||
}, {});
|
||||
console.log(this.errors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,28 +27,28 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { validateEmailField, validateRequiredField } from "@/utils/validators";
|
||||
import { RESEND_CONFIRMATION_EMAIL } from "@/graphql/auth";
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { validateEmailField, validateRequiredField } from '@/utils/validators';
|
||||
import { RESEND_CONFIRMATION_EMAIL } from '@/graphql/auth';
|
||||
|
||||
@Component
|
||||
export default class ResendConfirmation extends Vue {
|
||||
@Prop({ type: String, required: false, default: "" }) email!: string;
|
||||
@Prop({ type: String, required: false, default: '' }) email!: string;
|
||||
|
||||
credentials = {
|
||||
email: ""
|
||||
email: '',
|
||||
};
|
||||
validationSent = false;
|
||||
error = false;
|
||||
state = {
|
||||
email: {
|
||||
status: null,
|
||||
msg: ""
|
||||
}
|
||||
msg: '',
|
||||
},
|
||||
};
|
||||
rules = {
|
||||
required: validateRequiredField,
|
||||
email: validateEmailField
|
||||
email: validateEmailField,
|
||||
};
|
||||
|
||||
mounted() {
|
||||
@@ -63,8 +63,8 @@ export default class ResendConfirmation extends Vue {
|
||||
await this.$apollo.mutate({
|
||||
mutation: RESEND_CONFIRMATION_EMAIL,
|
||||
variables: {
|
||||
email: this.credentials.email
|
||||
}
|
||||
email: this.credentials.email,
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
||||
@@ -28,29 +28,29 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { validateEmailField, validateRequiredField } from "@/utils/validators";
|
||||
import { SEND_RESET_PASSWORD } from "@/graphql/auth";
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { validateEmailField, validateRequiredField } from '@/utils/validators';
|
||||
import { SEND_RESET_PASSWORD } from '@/graphql/auth';
|
||||
|
||||
@Component
|
||||
export default class SendPasswordReset extends Vue {
|
||||
@Prop({ type: String, required: false, default: "" }) email!: string;
|
||||
@Prop({ type: String, required: false, default: '' }) email!: string;
|
||||
|
||||
credentials = {
|
||||
email: ""
|
||||
email: '',
|
||||
} as { email: string };
|
||||
validationSent: boolean = false;
|
||||
errors: string[] = [];
|
||||
state = {
|
||||
email: {
|
||||
status: null,
|
||||
msg: ""
|
||||
} as { status: boolean | null; msg: string }
|
||||
msg: '',
|
||||
} as { status: boolean | null; msg: string },
|
||||
};
|
||||
|
||||
rules = {
|
||||
required: validateRequiredField,
|
||||
email: validateEmailField
|
||||
email: validateEmailField,
|
||||
};
|
||||
|
||||
mounted() {
|
||||
@@ -64,8 +64,8 @@ export default class SendPasswordReset extends Vue {
|
||||
await this.$apollo.mutate({
|
||||
mutation: SEND_RESET_PASSWORD,
|
||||
variables: {
|
||||
email: this.credentials.email
|
||||
}
|
||||
email: this.credentials.email,
|
||||
},
|
||||
});
|
||||
|
||||
this.validationSent = true;
|
||||
@@ -81,8 +81,8 @@ export default class SendPasswordReset extends Vue {
|
||||
this.state = {
|
||||
email: {
|
||||
status: null,
|
||||
msg: ""
|
||||
}
|
||||
msg: '',
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { VALIDATE_USER } from "@/graphql/user";
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { AUTH_TOKEN, AUTH_USER_ID } from "@/constants";
|
||||
import { RouteName } from '@/router'
|
||||
import { UserRouteName } from '@/router/user'
|
||||
import { VALIDATE_USER } from '@/graphql/user';
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
||||
import { AUTH_TOKEN, AUTH_USER_ID } from '@/constants';
|
||||
import { RouteName } from '@/router';
|
||||
import { UserRouteName } from '@/router/user';
|
||||
|
||||
@Component
|
||||
export default class Validate extends Vue {
|
||||
@@ -39,8 +39,8 @@ export default class Validate extends Vue {
|
||||
const { data } = await this.$apollo.mutate({
|
||||
mutation: VALIDATE_USER,
|
||||
variables: {
|
||||
token: this.token
|
||||
}
|
||||
token: this.token,
|
||||
},
|
||||
});
|
||||
|
||||
this.saveUserData(data);
|
||||
|
||||
Reference in New Issue
Block a user