Skip to content

Instantly share code, notes, and snippets.

View TitasGailius's full-sized avatar

Titas Gailius TitasGailius

  • Namecheap.com
  • Vilnius, Lithuania
View GitHub Profile
export interface Module<State> {
state(): State
}
export interface FooState {
foo: String
}
export default class AuthModule implements Module<FooState> {
state() {
export interface Module<State> {
state(): State
}
export interface FooState {
foo: String,
}
// No error
const correct: Module<FooState> = {
export interface Module<State> {
state: (() => State)
}
export interface FooState {
user: String
}
const module: Module<FooState> = {
state() {
export default async ({ store, redirect, req }) => {
/**
* Unautheticated client handler.
*/
const unauthenticated = () => redirect('/login')
/**
* Fetch the user from an API.
*/
const fetch = async () => {
/**
* First, we will load all of this project's Javascript utilities and other
* dependencies. Then, we will be ready to develop a robust and powerful
* application frontend using useful Laravel and JavaScript libraries.
*/
import "./bootstrap"
import Vue from "vue"
import ExampleComponent from "./components/ExampleComponent.vue"
import router from "./router"
import Vue from "vue"
import Vuex, { StoreOptions } from "vuex"
import { RootState, Todo } from "../types/store";
import axios from "axios"
Vue.use(Vuex)
export default new Vuex.Store({
state: {
todos: []
export interface RootState {
todos: Todo[]
}
export interface Todo {
done: boolean
name: string
}
/**
* First, we will load all of this project's Javascript utilities and other
* dependencies. Then, we will be ready to develop a robust and powerful
* application frontend using useful Laravel and JavaScript libraries.
*/
import "./bootstrap"
import Vue from "vue"
import ExampleComponent from "./components/ExampleComponent.vue"
import router from "./router"
import Vue from "vue"
import VueRouter from "vue-router"
import IndexPage from "./views/Index.vue"
Vue.use(VueRouter)
export default new VueRouter({
mode: 'history',
routes: [
/**
* First, we will load all of this project's Javascript utilities and other
* dependencies. Then, we will be ready to develop a robust and powerful
* application frontend using useful Laravel and JavaScript libraries.
*/
import "./bootstrap"
import Vue from "vue"
import ExampleComponent from "./components/ExampleComponent.vue"