This file contains hidden or 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
| import { api, throttle } from '@/utils'; | |
| const actions = { | |
| setEvents({ commit }, payload) { | |
| throttle(function* () { | |
| const { zip, radius } = payload; | |
| yield api.get('/events/general') | |
| .then(response => commit('SET_GENERAL_EVENTS', response.data) |
This file contains hidden or 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
| import store from '@/store'; | |
| /** | |
| * A simple class we create just for tracking our running functions | |
| */ | |
| class Concurrency { | |
| get(key) { | |
| return this[key] || {}; | |
| } |
This file contains hidden or 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
| function* genFunction() { | |
| yield 'Hi there!'; | |
| yield 'Is this working?'; | |
| yield 'Bye 👋'; | |
| }; | |
| const ourMethod = genFunction(); | |
| ourMethod.next(); | |
| // {value: "Hi there!", done: false} |
This file contains hidden or 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
| const actions = { | |
| setEvents({ commit }, payload) { | |
| const { zip, radius } = payload; | |
| api.get('/events/general') | |
| .then(response => commit('SET_GENERAL_EVENTS', response.data) | |
| .catch(catchError); | |
| api.get(`/events/zip/${zip}`, { params: { radius } }) |
This file contains hidden or 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
| <?php | |
| namespace upstatement\jobsboard\migrations; | |
| use upstatement\jobsboard\Jobsboard; | |
| use Craft; | |
| use craft\config\DbConfig; | |
| use craft\db\Migration; |
This file contains hidden or 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
| <?php | |
| namespace upstatement\jobsboard\elements; | |
| use upstatement\jobsboard\Jobsboard; | |
| // A bunch of other imports | |
| use Craft; | |
| use craft\base\Element; | |
| class Job extends Element { |
This file contains hidden or 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
| {% extends '_layouts/elementindex' %} | |
| {% set title = 'Jobs' %} | |
| {% set elementType = 'upstatement\\jobsboard\\elements\\Job' %} |
This file contains hidden or 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
| const mutations = { | |
| ... | |
| 'LAST_DISPATCHED_ACTION': (state, actionObject) => { | |
| state.lastDispatchedAction = actionObject; | |
| }, | |
| ... | |
| } |
This file contains hidden or 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
| import firebase from 'nativescript-plugin-firebase'; | |
| import { api } from '@/utils'; | |
| import store from '@/store'; | |
| /** | |
| * If we get an auth token failure, refresh it with firebase and try calling the same action again. | |
| * Otherwise, log an error listing which one failed | |
| */ | |
| const catchError = error => { | |
| const { status, data } = error.response; |
This file contains hidden or 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
| Object.defineProperty(store, 'retryLastAction', { | |
| value() { | |
| const { name, payload } = store.state.lastDispatchedAction; | |
| return store.dispatch(name, payload); | |
| }, | |
| }); |