-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vuex, 404 and non auth navbar (#35)
- Loading branch information
Showing
11 changed files
with
150 additions
and
31 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
<template> | ||
<navbar/> | ||
<router-view/> | ||
<Footer /> | ||
</template> | ||
|
||
<script lang='ts'> | ||
import { defineComponent } from 'vue' | ||
import Footer from './blocks/Footer.vue' | ||
import Navbar from './blocks/Navbar.vue' | ||
export default defineComponent({ | ||
components: { | ||
Footer, | ||
Navbar, | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<section class="hero is-large has-background-danger-light has-text-centered"> | ||
<div class="hero-body"> | ||
<h1 class="title"> | ||
404 | ||
</h1> | ||
<h2 class="subtitle"> | ||
Ой... Похоже, такой страницы не существует. | ||
</h2> | ||
<p class='has-text-danger'> | ||
<i :class="['fas fa-3x', currentIcon]"></i> | ||
</p> | ||
</div> | ||
</section> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
export default defineComponent({ | ||
data() { | ||
return { | ||
icons: [ | ||
'fa-frown', | ||
'fa-sad-tear', | ||
'fa-frown-open', | ||
'fa-sad-cry', | ||
], | ||
iconIndex: 0, | ||
} | ||
}, | ||
computed: { | ||
currentIcon(): String { | ||
return this.icons[this.iconIndex] | ||
} | ||
}, | ||
created() { | ||
setInterval(() => { | ||
this.iconIndex += 1 | ||
this.iconIndex = this.iconIndex >= this.icons.length ? 0 : this.iconIndex | ||
}, 3000) | ||
} | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
import { reactive } from 'vue' | ||
import { createStore } from 'vuex' | ||
import { Server } from './interfaces' | ||
|
||
export interface User { | ||
interface User { | ||
id: number, | ||
username: string, | ||
} | ||
|
||
interface State { | ||
user?: User, | ||
servers: Server[], | ||
} | ||
|
||
export default { | ||
state: reactive({ | ||
user: undefined, | ||
}) as State, | ||
} | ||
export default createStore({ | ||
state(): State { | ||
return { | ||
user: undefined, | ||
servers: [], | ||
} | ||
}, | ||
mutations: { | ||
setUser(state: State, payload) { | ||
state.user = payload.user | ||
}, | ||
removeUser(state: State) { | ||
state.user = undefined | ||
}, | ||
setServers(state: State, payload) { | ||
state.servers = payload.servers | ||
} | ||
} | ||
}) |