Compare commits

..

2 Commits

Author SHA1 Message Date
760b1b32a2 added baseurl_selfservice config
close #22
2021-03-26 20:10:26 +01:00
7b0bc22a71 [tmp] vue i18n error 2021-03-26 18:36:52 +01:00
7 changed files with 91 additions and 86 deletions

View File

@ -3,6 +3,8 @@ const config = {
documentserver_key: '',
// required
baseurl: '',
// optional, will fallback to /selfservice
baseurl_selfservice: '/selfservice',
// optional, will fallback to /imprint
url_imprint: '',
// optional, will fallback to /privacy

View File

@ -3,5 +3,5 @@
</template>
<script setup>
//
config.baseurl_selfservices = (config.baseurl_selfservices || "/selfservice");
</script>

View File

@ -9,7 +9,7 @@
<p
v-if="state.org_name !== ''"
class="mx-auto leading-relaxed text-base text-center"
>Organization: {{ state.org_name }}</p>
>{{ $t('organization') }}: {{ state.org_name }}</p>
<p v-else class="mx-auto leading-relaxed text-base text-center">Bürgerlauf</p>
<div class="mt-4">
<label for="first_name" class="block font-medium">
@ -247,6 +247,8 @@ import isEmail from 'validator/es/lib/isEmail';
import isMobilePhone from 'validator/es/lib/isMobilePhone';
import isPostalCode from 'validator/es/lib/isPostalCode';
import { useToast } from "vue-toastification";
import { router } from '../router';
import { i18n } from '../language';
const props = defineProps({
token: String
@ -305,9 +307,7 @@ function login() {
axios.post(url, postdata)
.then(({ data }) => {
const token = btoa(data.token);
location.replace("../profile/" + token)
//
toast.success("You have been registered!");
router.push(`${config.baseurl_selfservices}/profile/${token}`);
})
.catch((error) => {
console.log(error);

14
src/language.js Normal file
View File

@ -0,0 +1,14 @@
import * as keys_en from './locales/en.json';
import * as keys_de from './locales/de.json';
import { createI18n } from 'vue-i18n';
const messages = {
en: keys_en,
de: keys_de
};
const browserlocale = ((navigator.languages && navigator.languages[0]) || '').substr(0, 2);
export const i18n = createI18n({
locale: browserlocale,
fallbackLocale: 'en',
messages
});

View File

@ -1,41 +1,43 @@
{
"already_have_an_account": "Already have an account?",
"apartment_suite_etc": "Apartment, suite, etc.",
"configuration_error": "Configuration error",
"confirm_personal_data": "I hereby confirm that the above information is complete and correct",
"distance": "Distance",
"download_certificate": "Download certificate",
"e_mail_adress": "mail address",
"go_to_login": "Go To Login",
"i_accept": "I have read and accepted the ",
"i_accept_end": "",
"if_you_are_the_system_administrator_please_refer_to_the_official_product_documentation_readme_for_configuration_guidance": "If you are the system administrator, please refer to the official product documentation/ README for configuration guidance.",
"imprint": "Imprint",
"lap_time": "Lap time",
"lap_times": "Lap times",
"main_page_text": "Here you can register for the Lauf Für Kaya! or manage your runner profile.",
"mittelname": "Middlename",
"nachname": "Lastname",
"no_laps_scans_were_recorded_yet": "No laps/ scans were recorded yet...",
"ort": "City",
"phone_number": "Phone Number",
"please_provide_a_valid_zipcode": "Please provide a valid zipcode...",
"please_provide_valid_mail": "Please provide a valid mail address.",
"plz": "zipcode",
"privacy_policy": "Privacy Policy",
"profile": "Profile",
"provide_address": "Provide a postal address?",
"register": {
"register_now": "Register now for Lauf für Kaya! 2021."
},
"register_now": "Register now!",
"registrieren": "Register Now",
"save_changes": "Save changes",
"sponsoring": "Sponsoring",
"strasse": "Street/ Block",
"the_system_is_not_properly_configured_please_contact_the_system_administrator_for_help": "The system is not properly configured. Please contact the system administrator for help.",
"this_is_not_a_valid_international_phone_number": "This is not a valid international phone number",
"tos": "Terms of Service",
"view_my_data": "View my data",
"vorname": "Firstname"
"already_have_an_account": "Already have an account?",
"apartment_suite_etc": "Apartment, suite, etc.",
"configuration_error": "Configuration error",
"confirm_personal_data": "I hereby confirm that the above information is complete and correct",
"distance": "Distance",
"download_certificate": "Download certificate",
"e_mail_adress": "mail address",
"go_to_login": "Go To Login",
"i_accept": "I have read and accepted the ",
"i_accept_end": "",
"if_you_are_the_system_administrator_please_refer_to_the_official_product_documentation_readme_for_configuration_guidance": "If you are the system administrator, please refer to the official product documentation/ README for configuration guidance.",
"imprint": "Imprint",
"lap_time": "Lap time",
"lap_times": "Lap times",
"main_page_text": "Here you can register for the Lauf Für Kaya! or manage your runner profile.",
"mittelname": "Middlename",
"nachname": "Lastname",
"no_laps_scans_were_recorded_yet": "No laps/ scans were recorded yet...",
"ort": "City",
"phone_number": "Phone Number",
"please_provide_a_valid_zipcode": "Please provide a valid zipcode...",
"please_provide_valid_mail": "Please provide a valid mail address.",
"plz": "zipcode",
"privacy_policy": "Privacy Policy",
"profile": "Profile",
"provide_address": "Provide a postal address?",
"register": {
"register_now": "Register now for Lauf für Kaya! 2021."
},
"register_now": "Register now!",
"registrieren": "Register Now",
"save_changes": "Save changes",
"sponsoring": "Sponsoring",
"strasse": "Street/ Block",
"the_system_is_not_properly_configured_please_contact_the_system_administrator_for_help": "The system is not properly configured. Please contact the system administrator for help.",
"this_is_not_a_valid_international_phone_number": "This is not a valid international phone number",
"tos": "Terms of Service",
"view_my_data": "View my data",
"vorname": "Firstname",
"organization": "Organization",
"you_have_been_registered": "You have been registered!"
}

View File

@ -1,49 +1,10 @@
import { createApp } from 'vue';
import { createWebHistory, createRouter } from 'vue-router';
import App from './App.vue';
import { createI18n } from 'vue-i18n';
import Toast from 'vue-toastification';
import 'windi.css';
import 'toastify-js/src/toastify.css';
import 'vue-toastification/dist/index.css';
import * as keys_en from './locales/en.json';
import * as keys_de from './locales/de.json';
import { router } from './router';
import { i18n } from './language';
const messages = {
en: keys_en,
de: keys_de
};
const browserlocale = ((navigator.languages && navigator.languages[0]) || '').substr(0, 2);
const i18n = createI18n({
locale: browserlocale,
fallbackLocale: 'en',
messages
});
// ---------------
const EnvError = import('./components/EnvError.vue');
const Home = import('./components/Home.vue');
const Imprint = import('./components/Imprint.vue');
const Privacy = import('./components/Privacy.vue');
const Register = () => import('./components/Register.vue');
const Profile = () => import('./components/Profile.vue');
//
let routes = [ { path: '/:pathMatch(.*)*', component: EnvError } ];
if (typeof config !== 'undefined') {
if (config.baseurl && config.documentserver_key) {
routes = [
{ path: '/', component: Home },
{ path: '/imprint', component: Imprint },
{ path: '/privacy', component: Privacy },
{ path: '/register', component: Register },
{ path: '/register/:token', component: Register, props: true },
{ path: '/profile/:token', component: Profile, props: true }
];
}
}
const router = createRouter({
history: createWebHistory(),
routes
});
// ---------------
createApp(App).use(Toast).use(i18n).use(router).mount('#app');

26
src/router.js Normal file
View File

@ -0,0 +1,26 @@
import { createWebHistory, createRouter } from 'vue-router';
// ------------
const EnvError = import('./components/EnvError.vue');
const Home = import('./components/Home.vue');
const Imprint = import('./components/Imprint.vue');
const Privacy = import('./components/Privacy.vue');
const Register = () => import('./components/Register.vue');
const Profile = () => import('./components/Profile.vue');
//
let routes = [ { path: '/:pathMatch(.*)*', component: EnvError } ];
if (typeof config !== 'undefined') {
if (config.baseurl && config.documentserver_key) {
routes = [
{ path: '/', component: Home },
{ path: '/imprint', component: Imprint },
{ path: '/privacy', component: Privacy },
{ path: '/register', component: Register },
{ path: '/register/:token', component: Register, props: true },
{ path: '/profile/:token', component: Profile, props: true }
];
}
}
export const router = createRouter({
history: createWebHistory(),
routes
});