diff --git a/app/api/index.js b/app/api/index.js index e5e886d..f39eee4 100644 --- a/app/api/index.js +++ b/app/api/index.js @@ -1,7 +1,7 @@ import axios from 'axios' -export const detectCode = data => axios.post('/_/programming_language_detect', data) export const detectSpam = data => axios.post('/_/viblo-lang-and-spam-detection/', data) +export const detectCode = data => axios.post('/_/viblo-programming-language-detection/', data) export const tagCompare = data => axios.post('/_/tag_compare', data) export const autoTagging = data => axios.post('/_/auto_tagging', data) export const detectLanguage = data => axios.post('/_/language_detect', data) diff --git a/app/contents/form-default/programming-language-detection.js b/app/contents/form-default/programming-language-detection.js index 97512dd..6db0d6c 100644 --- a/app/contents/form-default/programming-language-detection.js +++ b/app/contents/form-default/programming-language-detection.js @@ -1,19 +1,6 @@ -export const code = -` - $line) { - echo "Line #{$line_num} : " . htmlspecialchars($line) . "
\n"; -} +export const content = +"``` \r\nexport default {\r\n computed: {\r\n myGetter() {\r\n return this.$store.getters['myModule\/myGetter'];\r\n },\r\n myGetter2() {\r\n return this.$store.getters['myModule\/myGetter2'];\r\n }\r\n },\r\n\r\n methods: {\r\n myAction() {\r\n this.$store.dispatch('myModule\/myAction');\r\n },\r\n myAction2() {\r\n this.$store.dispatch('myModule\/myAction2');\r\n }\r\n }\r\n};\r\n```" -// Another example, let's get a web page into a string. See also file_get_contents(). -$html = implode('', file('http://www.example.com/')); - -// Using the optional flags parameter since PHP 5 -$trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); -?> -` +export const tag = [] diff --git a/app/pages/_lang/programming-language-detection.vue b/app/pages/_lang/programming-language-detection.vue index f86bf12..c168e71 100644 --- a/app/pages/_lang/programming-language-detection.vue +++ b/app/pages/_lang/programming-language-detection.vue @@ -3,7 +3,7 @@ @@ -11,7 +11,7 @@ @@ -23,7 +23,12 @@
{{ $t('form.labels.detected_programming_language') }}: - {{ result }} + + {{item.language}} + @@ -35,7 +40,7 @@ import { detectCode } from '~/api' import { servicePage } from '~/utils/page' import { getServiceItem } from '~/contents/services' - import * as formDefault from '~/contents/form-default/programming-language-detection' +import * as formDefault from '~/contents/form-default/programming-language-detection' export default { data() { @@ -51,7 +56,7 @@ onSubmit() { this.processing = true return detectCode(this.form) - .then(({ data }) => this.result = data.data.programming_language) + .then(({ data }) => this.result = data.code) .catch(_ => this.$message.error(this.$t('errors.something_wrong'))) .finally(() => this.processing = false) }