Skip to content

Commit f13acdc

Browse files
committed
Fix vue 00 sample
1 parent c45c6e5 commit f13acdc

File tree

5 files changed

+19
-17
lines changed

5 files changed

+19
-17
lines changed

samples/vuejs/typescript/00 Custom Validator/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@
3737
"file-loader": "^0.11.1",
3838
"html-webpack-plugin": "^2.28.0",
3939
"style-loader": "^0.16.1",
40-
"typescript": "^2.2.2",
40+
"typescript": "2.2.2",
4141
"url-loader": "^0.5.8",
4242
"webpack": "^2.3.3",
4343
"webpack-dev-server": "^2.4.2"
4444
},
4545
"dependencies": {
4646
"bootstrap": "^3.3.7",
47-
"lc-form-validation": "^1.0.0",
48-
"vue": "^2.2.6",
49-
"vue-router": "^2.4.0"
47+
"lc-form-validation": "file:../../../../lib/",
48+
"vue": "2.2.6",
49+
"vue-router": "2.4.0"
5050
}
5151
}

samples/vuejs/typescript/00 Custom Validator/src/common/components/form/validation.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Vue, {ComponentOptions} from 'vue';
1+
import Vue, { ComponentOptions } from 'vue';
22

33
interface Props extends Vue {
44
hasError: boolean;
@@ -15,7 +15,7 @@ export const ValidationComponent = Vue.extend({
1515
render: function(h) {
1616
let wrapperClass = `${this.className}`;
1717

18-
if(this.hasError) {
18+
if (this.hasError) {
1919
wrapperClass = `${wrapperClass} has-error`
2020
}
2121

@@ -28,4 +28,4 @@ export const ValidationComponent = Vue.extend({
2828
</div>
2929
);
3030
},
31-
} as ComponentOptions<Props>);
31+
} as ComponentOptions<Props>);

samples/vuejs/typescript/00 Custom Validator/src/pages/recipe/edit/components/form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ export const FormComponent = Vue.extend({
9090
</form>
9191
);
9292
},
93-
} as ComponentOptions<FormComponentOptions>);
93+
} as ComponentOptions<FormComponentOptions>);

samples/vuejs/typescript/00 Custom Validator/src/pages/recipe/edit/pageContainer.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import Vue, {ComponentOptions} from 'vue';
2-
import {RecipeEntity, RecipeError} from '../../../model';
3-
import {recipeAPI} from '../../../api/recipe';
4-
import {editFormValidation} from './validations/editFormValidation';
5-
import {EditRecipePage} from './page';
1+
import Vue, { ComponentOptions } from 'vue';
2+
import { RecipeEntity, RecipeError } from '../../../model';
3+
import { recipeAPI } from '../../../api/recipe';
4+
import { editFormValidation } from './validations/editFormValidation';
5+
import { EditRecipePage } from './page';
66

77
interface EditRecipeContainerOptions extends Vue {
88
recipe: RecipeEntity;
@@ -84,10 +84,12 @@ export const EditRecipeContainer = Vue.extend({
8484
save: function() {
8585
editFormValidation.validateForm(this.recipe)
8686
.then((result) => {
87-
result.fieldErrors
88-
.map((error) => this.updateRecipeError(error.key, error));
87+
this.recipeError = {
88+
...this.recipeError,
89+
...result.fieldErrors,
90+
};
8991

90-
if(result.succeeded) {
92+
if (result.succeeded) {
9193
console.log('Save recipe');
9294
}
9395
});

samples/vuejs/typescript/00 Custom Validator/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
"exclude": [
1919
"node_modules"
2020
]
21-
}
21+
}

0 commit comments

Comments
 (0)