Skip to content

Commit 0cbbe41

Browse files
committed
update and format
1 parent c7ec745 commit 0cbbe41

File tree

6 files changed

+85
-85
lines changed

6 files changed

+85
-85
lines changed

src/components/Languages.vue

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ import { languages } from "@/i18n/index";
1717
1818
export default defineComponent({
1919
setup() {
20-
const route = useRoute(),
21-
router = useRouter(),
22-
i18n = useI18n(),
23-
selectedValue = ref(i18n.locale.value),
24-
updateValue = (event: Event) => {
25-
const basePath = (() => {
26-
if (route.params.lang) {
27-
return route.path.slice(route.params.lang.length + 1);
28-
}
29-
return route.path;
30-
})(),
31-
target = event.target as HTMLSelectElement,
32-
newPath = `/${target.value}${basePath}`;
33-
if (newPath !== route.path) {
34-
router.push(newPath);
35-
}
36-
};
20+
const route = useRoute();
21+
const router = useRouter();
22+
const i18n = useI18n();
23+
const selectedValue = ref(i18n.locale.value);
24+
const updateValue = (event: Event) => {
25+
const basePath = (() => {
26+
if (route.params.lang) {
27+
return route.path.slice(route.params.lang.length + 1);
28+
}
29+
return route.path;
30+
})(),
31+
target = event.target as HTMLSelectElement,
32+
newPath = `/${target.value}${basePath}`;
33+
if (newPath !== route.path) {
34+
router.push(newPath);
35+
}
36+
};
3737
return {
3838
languages,
3939
selectedValue,

src/components/Layout.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export default defineComponent({
4747
MenuList,
4848
},
4949
setup() {
50-
const store = useStore(),
51-
user = reactive<UserData>({ user: null }),
52-
menu = ref(false);
50+
const store = useStore();
51+
const user = reactive<UserData>({ user: null });
52+
const menu = ref(false);
5353
5454
useI18nParam();
5555

src/components/MenuList.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ export default defineComponent({
2525
},
2626
emits: [emitClose],
2727
setup(__, ctx) {
28-
const store = useStore(),
29-
handleClose = () => {
30-
ctx.emit(emitClose);
31-
},
32-
logout = () => {
33-
signOut(auth);
34-
ctx.emit(emitClose);
35-
};
28+
const store = useStore();
29+
const handleClose = () => {
30+
ctx.emit(emitClose);
31+
};
32+
const logout = () => {
33+
signOut(auth);
34+
ctx.emit(emitClose);
35+
};
3636
return {
3737
handleClose,
3838
logout,

src/router/index.ts

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,49 @@ import About from "@/views/About.vue";
99
import MyPage from "@/views/MyPage.vue";
1010

1111
const routeChildren: Array<RouteRecordRaw> = [
12-
{
13-
path: "",
14-
component: Home,
15-
},
16-
{
17-
path: "about",
18-
component: About,
19-
},
20-
{
21-
path: "account",
22-
component: Account,
23-
},
24-
{
25-
path: "mypage",
26-
component: MyPage,
27-
},
28-
],
29-
routes: Array<RouteRecordRaw> = [
30-
{
31-
path: "/",
32-
component: Layout,
33-
children: [
34-
{
35-
path: "/:lang",
36-
component: Blank,
37-
children: routeChildren,
38-
},
39-
{
40-
path: "",
41-
component: Blank,
42-
children: routeChildren,
43-
},
44-
],
45-
},
46-
{
47-
path: "/:page(.*)",
48-
name: "NotFoundPage",
49-
component: NotFound,
50-
},
51-
],
52-
router = createRouter({
53-
history: createWebHistory(import.meta.env.BASE_URL),
54-
routes,
55-
});
12+
{
13+
path: "",
14+
component: Home,
15+
},
16+
{
17+
path: "about",
18+
component: About,
19+
},
20+
{
21+
path: "account",
22+
component: Account,
23+
},
24+
{
25+
path: "mypage",
26+
component: MyPage,
27+
},
28+
];
29+
const routes: Array<RouteRecordRaw> = [
30+
{
31+
path: "/",
32+
component: Layout,
33+
children: [
34+
{
35+
path: "/:lang",
36+
component: Blank,
37+
children: routeChildren,
38+
},
39+
{
40+
path: "",
41+
component: Blank,
42+
children: routeChildren,
43+
},
44+
],
45+
},
46+
{
47+
path: "/:page(.*)",
48+
name: "NotFoundPage",
49+
component: NotFound,
50+
},
51+
];
52+
const router = createRouter({
53+
history: createWebHistory(import.meta.env.BASE_URL),
54+
routes,
55+
});
5656

5757
export default router;

src/store/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { computed, ref } from "vue";
33
import { User } from "firebase/auth";
44

55
export const useStore = defineStore("store", () => {
6-
const user = ref<User | null | undefined>(undefined),
7-
setUser = (_user: User | null) => {
8-
user.value = _user;
9-
},
10-
isSignedIn = computed(() => user.value !== null && user.value !== undefined);
6+
const user = ref<User | null | undefined>(undefined);
7+
const setUser = (_user: User | null) => {
8+
user.value = _user;
9+
};
10+
const isSignedIn = computed(() => user.value !== null && user.value !== undefined);
1111
return {
1212
user,
1313
setUser,

src/utils/utils.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ export const useIsSignedIn = () => {
1313
};
1414

1515
export const useLang = () => {
16-
const i18n = useI18n(),
17-
lang = computed(() => i18n.locale.value),
18-
localizedUrl = (path: string) => {
19-
if (lang.value) {
20-
return `/${lang.value}${path}`;
21-
}
22-
return path;
23-
};
16+
const i18n = useI18n();
17+
const lang = computed(() => i18n.locale.value);
18+
const localizedUrl = (path: string) => {
19+
if (lang.value) {
20+
return `/${lang.value}${path}`;
21+
}
22+
return path;
23+
};
2424

2525
return {
2626
lang,

0 commit comments

Comments
 (0)