More progress, committing to get assistance with TS

This commit is contained in:
Dane Everitt 2018-12-29 15:51:13 -08:00
parent a76bde5b1d
commit ed5ebe9155
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 45 additions and 27 deletions

View file

@ -1,19 +1,23 @@
import axios from 'axios'; import axios, {AxiosInstance} from 'axios';
// This token is set in the bootstrap.js file at the beginning of the request // This token is set in the bootstrap.js file at the beginning of the request
// and is carried through from there. // and is carried through from there.
// const token: string = ''; // const token: string = '';
const http = axios.create({ const http: AxiosInstance = axios.create({
headers: {
'X-Requested-With': 'XMLHttpRequest', 'X-Requested-With': 'XMLHttpRequest',
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
},
}); });
// If we have a phpdebugbar instance registered at this point in time go // If we have a phpdebugbar instance registered at this point in time go
// ahead and route the response data through to it so things show up. // ahead and route the response data through to it so things show up.
// @ts-ignore
if (typeof window.phpdebugbar !== 'undefined') { if (typeof window.phpdebugbar !== 'undefined') {
http.interceptors.response.use(response => { http.interceptors.response.use(response => {
// @ts-ignore
window.phpdebugbar.ajaxHandler.handle(response.request); window.phpdebugbar.ajaxHandler.handle(response.request);
return response; return response;

View file

@ -1,16 +1,13 @@
import http from './../http'; import http from '../http';
import filter from 'lodash/filter'; import { filter, isObject } from 'lodash';
import isObject from 'lodash/isObject'; // @ts-ignore
import route from '../../../../../vendor/tightenco/ziggy/src/js/route'; import route from '../../../../../vendor/tightenco/ziggy/src/js/route';
import {DirectoryContents} from "./types";
/** /**
* Get the contents of a specific directory for a given server. * Get the contents of a specific directory for a given server.
*
* @param {String} server
* @param {String} directory
* @return {Promise}
*/ */
export function getDirectoryContents (server, directory) { export function getDirectoryContents (server: string, directory: string): Promise<DirectoryContents> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
http.get(route('server.files', { server, directory })) http.get(route('server.files', { server, directory }))
.then((response) => { .then((response) => {
@ -30,7 +27,7 @@ export function getDirectoryContents (server, directory) {
} }
if (err.response.data && isObject(err.response.data.errors)) { if (err.response.data && isObject(err.response.data.errors)) {
err.response.data.errors.forEach(error => { err.response.data.errors.forEach((error: any) => {
return reject(error.detail); return reject(error.detail);
}); });
} }

View file

@ -0,0 +1,5 @@
export type DirectoryContents = {
files: Array<string>,
directories: Array<string>,
editable: Array<string>
}

View file

@ -15,13 +15,14 @@
</div> </div>
</template> </template>
<script> <script lang="ts">
import Vue from 'vue';
import Flash from '../Flash'; import Flash from '../Flash';
import ForgotPassword from "./ForgotPassword"; import ForgotPassword from "./ForgotPassword";
import LoginForm from "./LoginForm"; import LoginForm from "./LoginForm";
import TwoFactorForm from "./TwoFactorForm"; import TwoFactorForm from "./TwoFactorForm";
export default { export default Vue.extend({
name: 'login', name: 'login',
data: function () { data: function () {
return { return {
@ -41,5 +42,5 @@
ForgotPassword, ForgotPassword,
LoginForm, LoginForm,
}, },
} });
</script> </script>

View file

@ -4,7 +4,7 @@ import store from './store/index';
const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default; const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default;
// Base Vuejs Templates // Base Vuejs Templates
import Login from './components/auth/Login'; import Login from './components/auth/Login.vue';
import Dashboard from './components/dashboard/Dashboard'; import Dashboard from './components/dashboard/Dashboard';
import Account from './components/dashboard/Account'; import Account from './components/dashboard/Account';
import ResetPassword from './components/auth/ResetPassword'; import ResetPassword from './components/auth/ResetPassword';

0
storage/framework/cache/data/.gitignore vendored Normal file → Executable file
View file

View file

@ -1,16 +1,27 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "esnext",
"lib": [ "module": "esnext",
"es2015",
"es2016",
"dom"
],
"strict": true, "strict": true,
"moduleResolution": "node", "moduleResolution": "node",
"module": "es2015" "lib": [
}, "esnext",
"include": [ "dom",
"./resources/assets/scripts/**/*" "dom.iterable",
"scripthost"
],
"baseUrl": ".",
"paths": {
"@/*": [
"resources/*"
]
}
},
"include": [
"./resources/assets/**/*.ts",
"./resources/assets/**/*.vue"
],
"exclude": [
"node_modules"
] ]
} }

View file

@ -88,7 +88,7 @@ module.exports = {
loader: 'vue-loader', loader: 'vue-loader',
}, },
{ {
test: /\.tsx?$/, test: /\.ts$/,
loader: 'ts-loader', loader: 'ts-loader',
exclude: /node_modules/, exclude: /node_modules/,
options: { options: {