-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
593 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
<template> | ||
<div id="app"> | ||
<div id="nav"> | ||
<router-link to="/">Home</router-link> | | ||
<router-link to="/about">About</router-link> | ||
</div> | ||
<router-view /> | ||
</div> | ||
<v-app> | ||
<v-toolbar app tabs dense> | ||
<v-toolbar-title class="headline text-uppercase"> | ||
<span>Bored?</span> | ||
<span class="font-weight-thin">No more!</span> | ||
</v-toolbar-title> | ||
<v-spacer></v-spacer> | ||
<v-toolbar-items> | ||
<v-btn :to="{ name: 'Activity' }" append exact flat> | ||
Activity | ||
</v-btn> | ||
<v-btn :to="{ name: 'Activities' }" append flat> | ||
My List | ||
</v-btn> | ||
</v-toolbar-items> | ||
</v-toolbar> | ||
<v-content> | ||
<router-view /> | ||
</v-content> | ||
</v-app> | ||
</template> | ||
|
||
<style lang="scss"> | ||
#app { | ||
font-family: "Avenir", Helvetica, Arial, sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
text-align: center; | ||
color: #2c3e50; | ||
} | ||
#nav { | ||
padding: 30px; | ||
a { | ||
font-weight: bold; | ||
color: #2c3e50; | ||
&.router-link-exact-active { | ||
color: #42b983; | ||
} | ||
} | ||
} | ||
</style> | ||
<script> | ||
export default { | ||
name: "App" | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import axios from "axios"; | ||
import qs from "qs"; | ||
|
||
const instance = axios.create({ | ||
baseURL: "http://www.boredapi.com/api", | ||
paramsSerializer: function(params) { | ||
return qs.stringify(params, { strictNullHandling: true }); | ||
} | ||
}); | ||
|
||
export default { | ||
getActivity(params) { | ||
return instance.get("activity", { | ||
params: { ...params } | ||
}); | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export class Activity { | ||
constructor({ type, participants, price } = {}) { | ||
this.type = type; | ||
this.participants = participants; | ||
this.price = price; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Vue from "vue"; | ||
import Vuetify from "vuetify/lib"; | ||
import "vuetify/src/stylus/app.styl"; | ||
|
||
Vue.use(Vuetify, { | ||
iconfont: "fa" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,46 @@ | ||
import Vue from "vue"; | ||
import Vuex from "vuex"; | ||
import createPersistedState from "vuex-persistedstate"; | ||
import api from "@/api"; | ||
|
||
Vue.use(Vuex); | ||
|
||
export default new Vuex.Store({ | ||
state: {}, | ||
mutations: {}, | ||
actions: {} | ||
plugins: [createPersistedState({ paths: ["activitiesList"] })], | ||
state: { | ||
activity: {}, | ||
activitiesList: [] | ||
}, | ||
mutations: { | ||
setActivity(state, activity) { | ||
state.activity = activity; | ||
}, | ||
addToList(state) { | ||
state.activitiesList.push(state.activity); | ||
}, | ||
removeFromList(state, activity) { | ||
state.activitiesList = state.activitiesList.filter( | ||
({ key }) => key !== activity.key | ||
); | ||
}, | ||
clearAll(state) { | ||
state.activitiesList = []; | ||
} | ||
}, | ||
actions: { | ||
async loadActivity({ commit }, params = {}) { | ||
const { data: activity } = await api.getActivity(params); | ||
commit("setActivity", activity); | ||
}, | ||
async saveActivityToList({ state, commit }) { | ||
if ( | ||
state.activitiesList.some( | ||
({ key }) => state.activity.key && key === state.activity.key | ||
) | ||
) { | ||
return Promise.reject("You already saved this activity"); | ||
} | ||
commit("addToList"); | ||
} | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.