Lint JS files

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-03-22 10:57:14 +01:00
parent e319735ab9
commit b698eb470f
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
27 changed files with 237 additions and 243 deletions

View File

@ -21,55 +21,55 @@ import NavBar from '@/components/NavBar.vue';
import { Component, Vue } from 'vue-property-decorator'; import { Component, Vue } from 'vue-property-decorator';
import { AUTH_TOKEN, AUTH_USER_ACTOR, AUTH_USER_EMAIL, AUTH_USER_ID } from '@/constants'; import { AUTH_TOKEN, AUTH_USER_ACTOR, AUTH_USER_EMAIL, AUTH_USER_ID } from '@/constants';
import { CURRENT_USER_CLIENT, UPDATE_CURRENT_USER_CLIENT } from '@/graphql/user'; import { CURRENT_USER_CLIENT, UPDATE_CURRENT_USER_CLIENT } from '@/graphql/user';
import { ICurrentUser } from '@/types/current-user.model' import { ICurrentUser } from '@/types/current-user.model';
@Component({ @Component({
apollo: { apollo: {
currentUser: { currentUser: {
query: CURRENT_USER_CLIENT query: CURRENT_USER_CLIENT,
} },
}, },
components: { components: {
NavBar NavBar,
} },
}) })
export default class App extends Vue { export default class App extends Vue {
drawer = false; drawer = false;
fab = false; fab = false;
items = [ items = [
{ {
icon: "poll", icon: 'poll',
text: "Events", text: 'Events',
route: "EventList", route: 'EventList',
role: null role: null,
}, },
{ {
icon: "group", icon: 'group',
text: "Groups", text: 'Groups',
route: "GroupList", route: 'GroupList',
role: null role: null,
}, },
{ icon: "settings", text: "Settings", role: "ROLE_USER" }, { icon: 'settings', text: 'Settings', role: 'ROLE_USER' },
{ icon: "chat_bubble", text: "Send feedback", role: "ROLE_USER" }, { icon: 'chat_bubble', text: 'Send feedback', role: 'ROLE_USER' },
{ icon: "help", text: "Help", role: null }, { icon: 'help', text: 'Help', role: null },
{ icon: "phonelink", text: "App downloads", role: null } { icon: 'phonelink', text: 'App downloads', role: null },
]; ];
error = { error = {
timeout: 3000, timeout: 3000,
show: false, show: false,
text: "" text: '',
}; };
currentUser!: ICurrentUser; currentUser!: ICurrentUser;
actor = localStorage.getItem(AUTH_USER_ACTOR); actor = localStorage.getItem(AUTH_USER_ACTOR);
mounted () { mounted () {
this.initializeCurrentUser() this.initializeCurrentUser();
} }
get displayed_name () { get displayed_name () {
// FIXME: load actor // FIXME: load actor
return "no implemented"; return 'no implemented';
// return this.actor.display_name === null ? this.actor.username : this.actor.display_name // return this.actor.display_name === null ? this.actor.username : this.actor.display_name
} }

View File

@ -10,7 +10,7 @@
<router-link :to="{ name: 'Event', params:{ uuid: event.uuid } }"> <router-link :to="{ name: 'Event', params:{ uuid: event.uuid } }">
<h2 class="title">{{ event.title }}</h2> <h2 class="title">{{ event.title }}</h2>
</router-link> </router-link>
<span>{{ event.begins_on | formatDay }}</span> <span>{{ event.beginsOn | formatDay }}</span>
</div> </div>
<div v-if="!hideDetails"> <div v-if="!hideDetails">
<div v-if="event.participants.length === 1"> <div v-if="event.participants.length === 1">
@ -33,8 +33,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import {IEvent, ParticipantRole} from "@/types/event.model"; import { IEvent, ParticipantRole } from '@/types/event.model';
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
@Component @Component
export default class EventCard extends Vue { export default class EventCard extends Vue {
@ -43,8 +43,8 @@ export default class EventCard extends Vue {
data() { data() {
return { return {
ParticipantRole: ParticipantRole ParticipantRole,
} };
} }
} }
</script> </script>

View File

@ -19,8 +19,8 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
import { IGroup } from "../../types/actor.model"; import { IGroup } from '../../types/actor.model';
@Component @Component
export default class GroupCard extends Vue { export default class GroupCard extends Vue {

View File

@ -43,14 +43,14 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue, Watch } from "vue-property-decorator"; import { Component, Vue, Watch } from 'vue-property-decorator';
import { SEARCH } from "@/graphql/search"; import { SEARCH } from '@/graphql/search';
import { CURRENT_USER_CLIENT } from "@/graphql/user"; import { CURRENT_USER_CLIENT } from '@/graphql/user';
import { onLogout } from "@/vue-apollo"; import { onLogout } from '@/vue-apollo';
import { deleteUserData } from "@/utils/auth"; import { deleteUserData } from '@/utils/auth';
import { LOGGED_PERSON } from "@/graphql/actor"; import { LOGGED_PERSON } from '@/graphql/actor';
import { IActor, IPerson } from '@/types/actor.model'; import { IActor, IPerson } from '@/types/actor.model';
import { RouteName } from '@/router' import { RouteName } from '@/router';
@Component({ @Component({
apollo: { apollo: {
@ -58,25 +58,25 @@ import { RouteName } from '@/router'
query: SEARCH, query: SEARCH,
variables() { variables() {
return { return {
searchText: this.searchText searchText: this.searchText,
}; };
}, },
skip() { skip() {
return !this.searchText; return !this.searchText;
} },
}, },
currentUser: { currentUser: {
query: CURRENT_USER_CLIENT query: CURRENT_USER_CLIENT,
}, },
loggedPerson: { loggedPerson: {
query: LOGGED_PERSON query: LOGGED_PERSON,
} },
} },
}) })
export default class NavBar extends Vue { export default class NavBar extends Vue {
notifications = [ notifications = [
{ header: "Coucou" }, { header: 'Coucou' },
{ title: "T'as une notification", subtitle: "Et elle est cool" } { title: "T'as une notification", subtitle: 'Et elle est cool' },
]; ];
model = null; model = null;
search: any[] = []; search: any[] = [];
@ -87,12 +87,12 @@ export default class NavBar extends Vue {
get items() { get items() {
return this.search.map(searchEntry => { return this.search.map(searchEntry => {
switch (searchEntry.__typename) { switch (searchEntry.__typename) {
case "Actor": case 'Actor':
searchEntry.label = searchEntry.label =
searchEntry.preferredUsername + searchEntry.preferredUsername +
(searchEntry.domain === null ? "" : `@${searchEntry.domain}`); (searchEntry.domain === null ? '' : `@${searchEntry.domain}`);
break; break;
case "Event": case 'Event':
searchEntry.label = searchEntry.title; searchEntry.label = searchEntry.title;
break; break;
} }
@ -124,8 +124,8 @@ export default class NavBar extends Vue {
} }
enter() { enter() {
console.log("enter"); console.log('enter');
this.$apollo.queries["search"].refetch(); this.$apollo.queries['search'].refetch();
} }
logout() { logout() {

View File

@ -24,8 +24,8 @@ export const FETCH_EVENT = gql`
status, status,
visibility, visibility,
thumbnail, thumbnail,
large_image, largeImage,
publish_at, publishAt,
category, category,
# online_address, # online_address,
# phone_address, # phone_address,
@ -60,8 +60,8 @@ export const FETCH_EVENTS = gql`
status, status,
visibility, visibility,
thumbnail, thumbnail,
large_image, largeImage,
publish_at, publishAt,
# online_address, # online_address,
# phone_address, # phone_address,
organizerActor { organizerActor {

View File

@ -3,7 +3,7 @@
import Vue from 'vue'; import Vue from 'vue';
// import * as VueGoogleMaps from 'vue2-google-maps'; // import * as VueGoogleMaps from 'vue2-google-maps';
import VueSimpleMarkdown from 'vue-simple-markdown'; import VueSimpleMarkdown from 'vue-simple-markdown';
import Buefy from 'buefy' import Buefy from 'buefy';
import 'buefy/dist/buefy.css'; import 'buefy/dist/buefy.css';
import GetTextPlugin from 'vue-gettext'; import GetTextPlugin from 'vue-gettext';
import App from '@/App.vue'; import App from '@/App.vue';
@ -16,7 +16,7 @@ Vue.config.productionTip = false;
Vue.use(VueSimpleMarkdown); Vue.use(VueSimpleMarkdown);
Vue.use(Buefy, { Vue.use(Buefy, {
defaultContainerElement: '#mobilizon' defaultContainerElement: '#mobilizon',
}); });
const language = (window.navigator as any).userLanguage || window.navigator.language; const language = (window.navigator as any).userLanguage || window.navigator.language;
@ -34,8 +34,8 @@ Vue.config.language = language.replace('-', '_');
/* eslint-disable no-new */ /* eslint-disable no-new */
new Vue({ new Vue({
router, router,
apolloProvider,
el: '#app', el: '#app',
template: '<App/>', template: '<App/>',
apolloProvider,
components: { App }, components: { App },
}); });

View File

@ -1,4 +1,4 @@
export interface ICurrentUser { export interface ICurrentUser {
id: number, id: number;
email: string, email: string;
} }

View File

@ -1,4 +1,4 @@
import {Actor, IActor} from './actor.model'; import { Actor, IActor } from './actor.model';
export enum EventStatus { export enum EventStatus {
TENTATIVE, TENTATIVE,
@ -51,17 +51,17 @@ export interface IEvent {
description: string; description: string;
category: Category; category: Category;
begins_on: Date; beginsOn: Date;
ends_on: Date; endsOn: Date;
publish_at: Date; publishAt: Date;
status: EventStatus; status: EventStatus;
visibility: EventVisibility; visibility: EventVisibility;
join_options: EventJoinOptions; joinOptions: EventJoinOptions;
thumbnail: string; thumbnail: string;
large_image: string; largeImage: string;
organizerActor: IActor; organizerActor: IActor;
attributedTo: IActor; attributedTo: IActor;
@ -73,15 +73,15 @@ export interface IEvent {
export class EventModel implements IEvent { export class EventModel implements IEvent {
begins_on: Date = new Date(); beginsOn: Date = new Date();
category: Category = Category.MEETING; category: Category = Category.MEETING;
description: string = ''; description: string = '';
ends_on: Date = new Date(); endsOn: Date = new Date();
join_options: EventJoinOptions = EventJoinOptions.FREE; joinOptions: EventJoinOptions = EventJoinOptions.FREE;
large_image: string = ''; largeImage: string = '';
local: boolean = true; local: boolean = true;
participants: IParticipant[] = []; participants: IParticipant[] = [];
publish_at: Date = new Date(); publishAt: Date = new Date();
status: EventStatus = EventStatus.CONFIRMED; status: EventStatus = EventStatus.CONFIRMED;
thumbnail: string = ''; thumbnail: string = '';
title: string = ''; title: string = '';
@ -90,4 +90,4 @@ export class EventModel implements IEvent {
visibility: EventVisibility = EventVisibility.PUBLIC; visibility: EventVisibility = EventVisibility.PUBLIC;
attributedTo: IActor = new Actor(); attributedTo: IActor = new Actor();
organizerActor: IActor = new Actor(); organizerActor: IActor = new Actor();
} }

View File

@ -1,7 +1,7 @@
import { ICurrentUser } from '@/types/current-user.model'; import { ICurrentUser } from '@/types/current-user.model';
export interface ILogin { export interface ILogin {
user: ICurrentUser, user: ICurrentUser;
token: string, token: string;
} }

View File

@ -8,7 +8,7 @@ export function saveUserData(obj: ILogin) {
} }
export function deleteUserData() { export function deleteUserData() {
for (const key of [ AUTH_USER_ID, AUTH_USER_EMAIL, AUTH_TOKEN ]) { for (const key of [AUTH_USER_ID, AUTH_USER_EMAIL, AUTH_TOKEN]) {
localStorage.removeItem(key); localStorage.removeItem(key);
} }
} }

View File

@ -46,19 +46,19 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-property-decorator"; import { Component, Vue } from 'vue-property-decorator';
import { IDENTITIES, LOGGED_PERSON, CREATE_PERSON } from "../../graphql/actor"; import { IDENTITIES, LOGGED_PERSON, CREATE_PERSON } from '../../graphql/actor';
import { IPerson } from "@/types/actor.model"; import { IPerson } from '@/types/actor.model';
@Component({ @Component({
apollo: { apollo: {
identities: { identities: {
query: IDENTITIES query: IDENTITIES,
}, },
loggedPerson: { loggedPerson: {
query: LOGGED_PERSON query: LOGGED_PERSON,
} },
} },
}) })
export default class Identities extends Vue { export default class Identities extends Vue {
identities: IPerson[] = []; identities: IPerson[] = [];
@ -73,7 +73,7 @@ export default class Identities extends Vue {
try { try {
await this.$apollo.mutate({ await this.$apollo.mutate({
mutation: CREATE_PERSON, mutation: CREATE_PERSON,
variables: this.newPerson variables: this.newPerson,
}); });
this.showCreateProfileForm = false; this.showCreateProfileForm = false;
this.$apollo.queries.identities.refresh(); this.$apollo.queries.identities.refresh();

View File

@ -66,10 +66,10 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { FETCH_PERSON, LOGGED_PERSON } from "@/graphql/actor"; import { FETCH_PERSON, LOGGED_PERSON } from '@/graphql/actor';
import { Component, Prop, Vue, Watch } from "vue-property-decorator"; import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import EventCard from "@/components/Event/EventCard.vue"; import EventCard from '@/components/Event/EventCard.vue';
import { RouteName } from '@/router' import { RouteName } from '@/router';
@Component({ @Component({
apollo: { apollo: {
@ -77,17 +77,17 @@ import { RouteName } from '@/router'
query: FETCH_PERSON, query: FETCH_PERSON,
variables() { variables() {
return { return {
name: this.$route.params.name name: this.$route.params.name,
}; };
} },
}, },
loggedPerson: { loggedPerson: {
query: LOGGED_PERSON query: LOGGED_PERSON,
} },
}, },
components: { components: {
EventCard EventCard,
} },
}) })
export default class Profile extends Vue { export default class Profile extends Vue {
@Prop({ type: String, required: true }) name!: string; @Prop({ type: String, required: true }) name!: string;
@ -95,7 +95,7 @@ export default class Profile extends Vue {
person = null; person = null;
// call again the method if the route changes // call again the method if the route changes
@Watch("$route") @Watch('$route')
onRouteChange() { onRouteChange() {
// this.fetchData() // this.fetchData()
} }
@ -106,7 +106,7 @@ export default class Profile extends Vue {
} }
nl2br(text) { nl2br(text) {
return text.replace(/(?:\r\n|\r|\n)/g, "<br>"); return text.replace(/(?:\r\n|\r|\n)/g, '<br>');
} }
} }
</script> </script>

View File

@ -70,11 +70,11 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
import { IPerson } from "@/types/actor.model"; import { IPerson } from '@/types/actor.model';
import { REGISTER_PERSON } from "@/graphql/actor"; import { REGISTER_PERSON } from '@/graphql/actor';
import { MOBILIZON_INSTANCE_HOST } from "@/api/_entrypoint"; import { MOBILIZON_INSTANCE_HOST } from '@/api/_entrypoint';
import { RouteName } from '@/router' import { RouteName } from '@/router';
@Component @Component
export default class Register extends Vue { export default class Register extends Vue {
@ -104,7 +104,7 @@ export default class Register extends Vue {
this.errors = {}; this.errors = {};
await this.$apollo.mutate({ await this.$apollo.mutate({
mutation: REGISTER_PERSON, mutation: REGISTER_PERSON,
variables: Object.assign({ email: this.email }, this.person) variables: Object.assign({ email: this.email }, this.person),
}); });
this.validationSent = true; this.validationSent = true;
@ -115,7 +115,7 @@ export default class Register extends Vue {
this.errors = error.graphQLErrors.reduce((acc, error) => { this.errors = error.graphQLErrors.reduce((acc, error) => {
acc[error.details] = error.message; acc[error.details] = error.message;
return acc; return acc;
}, {}); }, {});
console.error(error); console.error(error);
console.error(this.errors); console.error(this.errors);
} }

View File

@ -10,7 +10,7 @@
<b-input aria-required="true" required v-model="event.title"/> <b-input aria-required="true" required v-model="event.title"/>
</b-field> </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-field :label="$gettext('Category')">
<b-select placeholder="Select a category" v-model="event.category"> <b-select placeholder="Select a category" v-model="event.category">
@ -31,23 +31,23 @@
</template> </template>
<script lang="ts"> <script lang="ts">
// import Location from '@/components/Location'; // import Location from '@/components/Location';
import {CREATE_EVENT, EDIT_EVENT} from "@/graphql/event"; import { CREATE_EVENT, EDIT_EVENT } from '@/graphql/event';
import {Component, Prop, Vue} from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
import { import {
Category, Category,
IEvent, IEvent,
EventModel, EventModel,
} from "@/types/event.model"; } from '@/types/event.model';
import {LOGGED_PERSON} from "@/graphql/actor"; import { LOGGED_PERSON } from '@/graphql/actor';
import {IPerson, Person} from "@/types/actor.model"; import { IPerson, Person } from '@/types/actor.model';
@Component({ @Component({
apollo: { apollo: {
loggedPerson: { loggedPerson: {
query: LOGGED_PERSON, query: LOGGED_PERSON,
} },
} },
}) })
export default class CreateEvent extends Vue { export default class CreateEvent extends Vue {
@Prop({ required: false, type: String }) uuid!: string; @Prop({ required: false, type: String }) uuid!: string;
@ -61,23 +61,23 @@ export default class CreateEvent extends Vue {
this.event.organizerActor = this.loggedPerson; this.event.organizerActor = this.loggedPerson;
this.event.attributedTo = this.loggedPerson; this.event.attributedTo = this.loggedPerson;
if (this.event.uuid === "") { if (this.event.uuid === '') {
this.$apollo this.$apollo
.mutate({ .mutate({
mutation: CREATE_EVENT, mutation: CREATE_EVENT,
variables: { variables: {
title: this.event.title, title: this.event.title,
description: this.event.description, description: this.event.description,
beginsOn: this.event.begins_on, beginsOn: this.event.beginsOn,
category: this.event.category, category: this.event.category,
organizerActorId: this.event.organizerActor.id organizerActorId: this.event.organizerActor.id,
} },
}) })
.then(data => { .then(data => {
console.log("event created", data); console.log('event created', data);
this.$router.push({ this.$router.push({
name: "Event", name: 'Event',
params: { uuid: data.data.createEvent.uuid } params: { uuid: data.data.createEvent.uuid },
}); });
}) })
.catch(error => { .catch(error => {
@ -86,12 +86,12 @@ export default class CreateEvent extends Vue {
} else { } else {
this.$apollo this.$apollo
.mutate({ .mutate({
mutation: EDIT_EVENT mutation: EDIT_EVENT,
}) })
.then(data => { .then(data => {
this.$router.push({ this.$router.push({
name: "Event", name: 'Event',
params: { uuid: data.data.uuid } params: { uuid: data.data.uuid },
}); });
}) })
.catch(error => { .catch(error => {

View File

@ -9,7 +9,7 @@
</figure> </figure>
</div> </div>
<div class="card-content"> <div class="card-content">
<span>{{ event.begins_on | formatDay }}</span> <span>{{ event.beginsOn | formatDay }}</span>
<span class="tag is-primary">{{ event.category }}</span> <span class="tag is-primary">{{ event.category }}</span>
<h1 class="title">{{ event.title }}</h1> <h1 class="title">{{ event.title }}</h1>
<router-link <router-link
@ -44,7 +44,7 @@
</p> </p>
</div> </div>
<div> <div>
<span>{{ event.begins_on | formatDate }} - {{ event.ends_on | formatDate }}</span> <span>{{ event.beginsOn | formatDate }} - {{ event.endsOn | formatDate }}</span>
</div> </div>
<p v-if="actorIsOrganizer()"> <p v-if="actorIsOrganizer()">
<translate>You are an organizer.</translate> <translate>You are an organizer.</translate>
@ -100,11 +100,10 @@
</template> </template>
<script lang="ts"> <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 { Component, Prop, Vue } from 'vue-property-decorator';
import { LOGGED_PERSON } from '@/graphql/actor'; import { LOGGED_PERSON } from '@/graphql/actor';
import { IEvent, IParticipant } from '@/types/event.model'; import { IEvent, IParticipant } from '@/types/event.model';
import { JOIN_EVENT } from '@/graphql/event';
import { IPerson } from '@/types/actor.model'; import { IPerson } from '@/types/actor.model';
import { RouteName } from '@/router'; import { RouteName } from '@/router';
import 'vue-simple-markdown/dist/vue-simple-markdown.css'; 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, query: FETCH_EVENT,
variables() { variables() {
return { return {
uuid: this.uuid uuid: this.uuid,
}; };
} },
}, },
loggedPerson: { loggedPerson: {
query: LOGGED_PERSON query: LOGGED_PERSON,
} },
} },
}) })
export default class Event extends Vue { export default class Event extends Vue {
@Prop({ type: String, required: true }) uuid!: string; @Prop({ type: String, required: true }) uuid!: string;
@ -140,10 +139,10 @@ export default class Event extends Vue {
variables: { variables: {
id: this.event.id, id: this.event.id,
actorId: this.loggedPerson.id, actorId: this.loggedPerson.id,
} },
}); });
router.push({ name: RouteName.EVENT }) router.push({ name: RouteName.EVENT });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
@ -161,13 +160,13 @@ export default class Event extends Vue {
const event = store.readQuery<IEvent>({ query: FETCH_EVENT }); const event = store.readQuery<IEvent>({ query: FETCH_EVENT });
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([joinEvent]);
store.writeQuery({ query: FETCH_EVENT, data: event }); store.writeQuery({ query: FETCH_EVENT, data: event });
} },
}); });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
@ -186,14 +185,14 @@ export default class Event extends Vue {
const event = store.readQuery<IEvent>({ query: FETCH_EVENT }); const event = store.readQuery<IEvent>({ query: FETCH_EVENT });
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 !== leaveEvent.actor.id);
store.writeQuery({ query: FETCH_EVENT, data: event }); store.writeQuery({ query: FETCH_EVENT, data: event });
} },
}); });
} catch (error) { } catch (error) {
console.error(error); console.error(error);

View File

@ -27,8 +27,8 @@ const ngeohash = require('ngeohash');
@Component({ @Component({
components: { components: {
EventCard EventCard,
} },
}) })
export default class EventList extends Vue { export default class EventList extends Vue {
@Prop(String) location!: string; @Prop(String) location!: string;
@ -39,7 +39,7 @@ export default class EventList extends Vue {
locationText = ''; locationText = '';
created() { created() {
this.fetchData(this.$router.currentRoute.params["location"]); this.fetchData(this.$router.currentRoute.params['location']);
} }
beforeRouteUpdate(to, from, next) { beforeRouteUpdate(to, from, next) {
@ -47,7 +47,7 @@ export default class EventList extends Vue {
next(); next();
} }
@Watch("locationChip") @Watch('locationChip')
onLocationChipChange(val) { onLocationChipChange(val) {
if (val === false) { if (val === false) {
this.$router.push({ name: RouteName.EVENT_LIST }); this.$router.push({ name: RouteName.EVENT_LIST });
@ -61,7 +61,7 @@ export default class EventList extends Vue {
} }
fetchData(location) { fetchData(location) {
let queryString = "/events"; let queryString = '/events';
if (location) { if (location) {
queryString += `?geohash=${location}`; queryString += `?geohash=${location}`;
const { latitude, longitude } = ngeohash.decode(location); const { latitude, longitude } = ngeohash.decode(location);

View File

@ -26,7 +26,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-property-decorator"; import { Component, Vue } from 'vue-property-decorator';
@Component({}) @Component({})
export default class CreateGroup extends Vue { export default class CreateGroup extends Vue {
@ -74,13 +74,13 @@ export default class CreateGroup extends Vue {
this.group.address = { this.group.address = {
geo: { geo: {
latitude: addressData.latitude, latitude: addressData.latitude,
longitude: addressData.longitude longitude: addressData.longitude,
}, },
addressCountry: addressData.country, addressCountry: addressData.country,
addressLocality: addressData.city, addressLocality: addressData.city,
addressRegion: addressData.administrative_area_level_1, addressRegion: addressData.administrative_area_level_1,
postalCode: addressData.postal_code, postalCode: addressData.postal_code,
streetAddress: `${addressData.street_number} ${addressData.route}` streetAddress: `${addressData.street_number} ${addressData.route}`,
}; };
} }
} }

View File

@ -60,9 +60,9 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator"; import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import EventCard from "@/components/Event/EventCard.vue"; import EventCard from '@/components/Event/EventCard.vue';
import { FETCH_PERSON, LOGGED_PERSON } from "@/graphql/actor"; import { FETCH_PERSON, LOGGED_PERSON } from '@/graphql/actor';
@Component({ @Component({
apollo: { apollo: {
@ -70,17 +70,17 @@ import { FETCH_PERSON, LOGGED_PERSON } from "@/graphql/actor";
query: FETCH_PERSON, query: FETCH_PERSON,
variables() { variables() {
return { return {
name: this.$route.params.name name: this.$route.params.name,
}; };
} },
}, },
loggedPerson: { loggedPerson: {
query: LOGGED_PERSON query: LOGGED_PERSON,
} },
}, },
components: { components: {
EventCard EventCard,
} },
}) })
export default class Group extends Vue { export default class Group extends Vue {
@Prop({ type: String, required: true }) name!: string; @Prop({ type: String, required: true }) name!: string;
@ -92,7 +92,7 @@ export default class Group extends Vue {
this.fetchData(); this.fetchData();
} }
@Watch("$route") @Watch('$route')
onRouteChanged() { onRouteChanged() {
// call again the method if the route changes // call again the method if the route changes
this.fetchData(); this.fetchData();

View File

@ -32,7 +32,7 @@ export default class GroupList extends Vue {
} }
usernameWithDomain(actor) { usernameWithDomain(actor) {
return actor.username + (actor.domain === null ? "" : `@${actor.domain}`); return actor.username + (actor.domain === null ? '' : `@${actor.domain}`);
} }
fetchData() { fetchData() {
@ -57,7 +57,7 @@ export default class GroupList extends Vue {
viewActor(actor) { viewActor(actor) {
this.$router.push({ this.$router.push({
name: RouteName.GROUP, name: RouteName.GROUP,
params: { name: this.usernameWithDomain(actor) } params: { name: this.usernameWithDomain(actor) },
}); });
} }

View File

@ -51,25 +51,20 @@ import { RouteName } from '@/router';
apollo: { apollo: {
events: { events: {
query: FETCH_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: { loggedPerson: {
query: LOGGED_PERSON query: LOGGED_PERSON,
}, },
currentUser: { currentUser: {
query: CURRENT_USER_CLIENT query: CURRENT_USER_CLIENT,
} },
}, },
components: { components: {
EventCard EventCard,
} },
}) })
export default class Home extends Vue { export default class Home extends Vue {
searchTerm = null;
location_field = {
loading: false,
search: null
};
events = []; events = [];
locations = []; locations = [];
city = { name: null }; city = { name: null };
@ -124,9 +119,9 @@ export default class Home extends Vue {
const geoHash = ngeohash.encode( const geoHash = ngeohash.encode(
addressData.latitude, addressData.latitude,
addressData.longitude, addressData.longitude,
11 11,
); );
sessionStorage.setItem("City", geoHash); sessionStorage.setItem('City', geoHash);
this.$router.push({ name: RouteName.EVENT_LIST, params: { location: geoHash } }); this.$router.push({ name: RouteName.EVENT_LIST, params: { location: geoHash } });
} }

View File

@ -3,28 +3,28 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
@Component @Component
export default class Location extends Vue { export default class Location extends Vue {
@Prop(String) address!: string; @Prop(String) address!: string;
description = "Paris, France"; description = 'Paris, France';
center = { lat: 48.85, lng: 2.35 }; center = { lat: 48.85, lng: 2.35 };
markers: any[] = []; markers: any[] = [];
setPlace(place) { setPlace(place) {
this.center = { this.center = {
lat: place.geometry.location.lat(), lat: place.geometry.location.lat(),
lng: place.geometry.location.lng() lng: place.geometry.location.lng(),
}; };
this.markers = [ 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> </script>

View File

@ -53,29 +53,29 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
import { LOGIN } from "@/graphql/auth"; import { LOGIN } from '@/graphql/auth';
import { validateEmailField, validateRequiredField } from "@/utils/validators"; import { validateEmailField, validateRequiredField } from '@/utils/validators';
import { saveUserData } from "@/utils/auth"; import { saveUserData } from '@/utils/auth';
import { ILogin } from "@/types/login.model"; import { ILogin } from '@/types/login.model';
import { UPDATE_CURRENT_USER_CLIENT } from "@/graphql/user"; import { UPDATE_CURRENT_USER_CLIENT } from '@/graphql/user';
import { onLogin } from "@/vue-apollo"; import { onLogin } from '@/vue-apollo';
import { RouteName } from '@/router' import { RouteName } from '@/router';
@Component @Component
export default class Login extends Vue { export default class Login extends Vue {
@Prop({ type: String, required: false, default: "" }) email!: string; @Prop({ type: String, required: false, default: '' }) email!: string;
@Prop({ type: String, required: false, default: "" }) password!: string; @Prop({ type: String, required: false, default: '' }) password!: string;
credentials = { credentials = {
email: "", email: '',
password: "" password: '',
}; };
validationSent = false; validationSent = false;
errors: string[] = []; errors: string[] = [];
rules = { rules = {
required: validateRequiredField, required: validateRequiredField,
email: validateEmailField email: validateEmailField,
}; };
user: any; user: any;
@ -99,8 +99,8 @@ export default class Login extends Vue {
mutation: LOGIN, mutation: LOGIN,
variables: { variables: {
email: this.credentials.email, email: this.credentials.email,
password: this.credentials.password password: this.credentials.password,
} },
}); });
saveUserData(result.data.login); saveUserData(result.data.login);
@ -109,8 +109,8 @@ export default class Login extends Vue {
mutation: UPDATE_CURRENT_USER_CLIENT, mutation: UPDATE_CURRENT_USER_CLIENT,
variables: { variables: {
id: result.data.login.user.id, id: result.data.login.user.id,
email: this.credentials.email email: this.credentials.email,
} },
}); });
onLogin(this.$apollo); onLogin(this.$apollo);

View File

@ -35,28 +35,28 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
import { validateRequiredField } from "@/utils/validators"; import { validateRequiredField } from '@/utils/validators';
import { RESET_PASSWORD } from "@/graphql/auth"; import { RESET_PASSWORD } from '@/graphql/auth';
import { saveUserData } from "@/utils/auth"; import { saveUserData } from '@/utils/auth';
import { ILogin } from "@/types/login.model"; import { ILogin } from '@/types/login.model';
import { RouteName } from '@/router' import { RouteName } from '@/router';
@Component @Component
export default class PasswordReset extends Vue { export default class PasswordReset extends Vue {
@Prop({ type: String, required: true }) token!: string; @Prop({ type: String, required: true }) token!: string;
credentials = { credentials = {
password: "", password: '',
password_confirmation: "" password_confirmation: '',
} as { password: string; password_confirmation: string }; } as { password: string; password_confirmation: string };
errors: string[] = []; errors: string[] = [];
rules = { rules = {
password_length: value => password_length: (value: string) =>
value.length > 6 || "Password must be at least 6 characters long", value.length > 6 || 'Password must be at least 6 characters long',
required: validateRequiredField, required: validateRequiredField,
password_equal: value => password_equal: (value: string) =>
value === this.credentials.password || "Passwords must be the same" value === this.credentials.password || 'Passwords must be the same',
}; };
get samePasswords() { get samePasswords() {
@ -75,8 +75,8 @@ export default class PasswordReset extends Vue {
mutation: RESET_PASSWORD, mutation: RESET_PASSWORD,
variables: { variables: {
password: this.credentials.password, password: this.credentials.password,
token: this.token token: this.token,
} },
}); });
saveUserData(result.data.resetPassword); saveUserData(result.data.resetPassword);

View File

@ -108,19 +108,19 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { CREATE_USER } from "@/graphql/user"; import { CREATE_USER } from '@/graphql/user';
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
import { UserRouteName } from '@/router/user' import { UserRouteName } from '@/router/user';
@Component @Component
export default class Register extends Vue { export default class Register extends Vue {
@Prop({ type: String, required: false, default: "" }) email!: string; @Prop({ type: String, required: false, default: '' }) email!: string;
@Prop({ type: String, required: false, default: "" }) password!: string; @Prop({ type: String, required: false, default: '' }) password!: string;
credentials = { credentials = {
email: this.email, email: this.email,
password: this.password password: this.password,
} };
errors: object = {}; errors: object = {};
sendingValidation: boolean = false; sendingValidation: boolean = false;
validationSent: boolean = false; validationSent: boolean = false;
@ -132,21 +132,21 @@ export default class Register extends Vue {
await this.$apollo.mutate({ await this.$apollo.mutate({
mutation: CREATE_USER, mutation: CREATE_USER,
variables: this.credentials variables: this.credentials,
}); });
this.validationSent = true; this.validationSent = true;
this.$router.push({ this.$router.push({
name: UserRouteName.REGISTER_PROFILE, name: UserRouteName.REGISTER_PROFILE,
params: { email: this.credentials.email } params: { email: this.credentials.email },
}); });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
this.errors = error.graphQLErrors.reduce((acc, error) => { this.errors = error.graphQLErrors.reduce((acc, error) => {
acc[error.details] = error.message; acc[error.details] = error.message;
return acc; return acc;
}, {}); }, {});
console.log(this.errors); console.log(this.errors);
} }
} }

View File

@ -27,28 +27,28 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
import { validateEmailField, validateRequiredField } from "@/utils/validators"; import { validateEmailField, validateRequiredField } from '@/utils/validators';
import { RESEND_CONFIRMATION_EMAIL } from "@/graphql/auth"; import { RESEND_CONFIRMATION_EMAIL } from '@/graphql/auth';
@Component @Component
export default class ResendConfirmation extends Vue { export default class ResendConfirmation extends Vue {
@Prop({ type: String, required: false, default: "" }) email!: string; @Prop({ type: String, required: false, default: '' }) email!: string;
credentials = { credentials = {
email: "" email: '',
}; };
validationSent = false; validationSent = false;
error = false; error = false;
state = { state = {
email: { email: {
status: null, status: null,
msg: "" msg: '',
} },
}; };
rules = { rules = {
required: validateRequiredField, required: validateRequiredField,
email: validateEmailField email: validateEmailField,
}; };
mounted() { mounted() {
@ -63,8 +63,8 @@ export default class ResendConfirmation extends Vue {
await this.$apollo.mutate({ await this.$apollo.mutate({
mutation: RESEND_CONFIRMATION_EMAIL, mutation: RESEND_CONFIRMATION_EMAIL,
variables: { variables: {
email: this.credentials.email email: this.credentials.email,
} },
}); });
} catch (err) { } catch (err) {
console.error(err); console.error(err);

View File

@ -28,29 +28,29 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
import { validateEmailField, validateRequiredField } from "@/utils/validators"; import { validateEmailField, validateRequiredField } from '@/utils/validators';
import { SEND_RESET_PASSWORD } from "@/graphql/auth"; import { SEND_RESET_PASSWORD } from '@/graphql/auth';
@Component @Component
export default class SendPasswordReset extends Vue { export default class SendPasswordReset extends Vue {
@Prop({ type: String, required: false, default: "" }) email!: string; @Prop({ type: String, required: false, default: '' }) email!: string;
credentials = { credentials = {
email: "" email: '',
} as { email: string }; } as { email: string };
validationSent: boolean = false; validationSent: boolean = false;
errors: string[] = []; errors: string[] = [];
state = { state = {
email: { email: {
status: null, status: null,
msg: "" msg: '',
} as { status: boolean | null; msg: string } } as { status: boolean | null; msg: string },
}; };
rules = { rules = {
required: validateRequiredField, required: validateRequiredField,
email: validateEmailField email: validateEmailField,
}; };
mounted() { mounted() {
@ -64,8 +64,8 @@ export default class SendPasswordReset extends Vue {
await this.$apollo.mutate({ await this.$apollo.mutate({
mutation: SEND_RESET_PASSWORD, mutation: SEND_RESET_PASSWORD,
variables: { variables: {
email: this.credentials.email email: this.credentials.email,
} },
}); });
this.validationSent = true; this.validationSent = true;
@ -81,8 +81,8 @@ export default class SendPasswordReset extends Vue {
this.state = { this.state = {
email: { email: {
status: null, status: null,
msg: "" msg: '',
} },
}; };
} }
} }

View File

@ -17,11 +17,11 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { VALIDATE_USER } from "@/graphql/user"; import { VALIDATE_USER } from '@/graphql/user';
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from 'vue-property-decorator';
import { AUTH_TOKEN, AUTH_USER_ID } from "@/constants"; import { AUTH_TOKEN, AUTH_USER_ID } from '@/constants';
import { RouteName } from '@/router' import { RouteName } from '@/router';
import { UserRouteName } from '@/router/user' import { UserRouteName } from '@/router/user';
@Component @Component
export default class Validate extends Vue { export default class Validate extends Vue {
@ -39,8 +39,8 @@ export default class Validate extends Vue {
const { data } = await this.$apollo.mutate({ const { data } = await this.$apollo.mutate({
mutation: VALIDATE_USER, mutation: VALIDATE_USER,
variables: { variables: {
token: this.token token: this.token,
} },
}); });
this.saveUserData(data); this.saveUserData(data);