Moved inputform and feed to index

This commit is contained in:
Liyas Thomas
2020-01-21 00:52:45 +05:30
parent 19a2323880
commit c7e5fc47ba
6 changed files with 83 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<form @submit.prevent="formPost"> <form @submit.prevent="formPost">
<input type="text" autofocus ref="inputMessage" v-model="message" /> <input type="text" autofocus ref="inputMessage" v-model="message" />
<input :disabled="!this.message" type="submit" value="DUNK!" /> <input :disabled="!this.message" type="submit" value="Save" />
</form> </form>
</template> </template>

View File

@@ -1,8 +1,43 @@
<template> <template>
<div> <v-popover>
<button @click.prevent="signInWithGoogle">Log in with Google</button> <button class="icon" v-tooltip="$t('login_with')">
<button @click.prevent="signInWithGithub">Log in with GitHub</button> <i class="material-icons">vpn_key</i>
</div> </button>
<template slot="popover">
<div>
<button class="icon" @click="signInWithGoogle" v-close-popover>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
class="material-icons"
>
<path
d="M12.24 10.285V14.4h6.806c-.275 1.765-2.056 5.174-6.806 5.174-4.095 0-7.439-3.389-7.439-7.574s3.345-7.574 7.439-7.574c2.33 0 3.891.989 4.785 1.849l3.254-3.138C18.189 1.186 15.479 0 12.24 0c-6.635 0-12 5.365-12 12s5.365 12 12 12c6.926 0 11.52-4.869 11.52-11.726 0-.788-.085-1.39-.189-1.989H12.24z"
/>
</svg>
<span>Google</span>
</button>
</div>
<div>
<button class="icon" @click="signInWithGithub" v-close-popover>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
class="material-icons"
>
<path
d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"
/>
</svg>
<span>GitHub</span>
</button>
</div>
</template>
</v-popover>
</template> </template>
<script> <script>
@@ -15,14 +50,22 @@ export default {
firebase firebase
.auth() .auth()
.signInWithPopup(provider) .signInWithPopup(provider)
.catch(err => alert(err.message || err)); .catch(err => {
this.$toast.show(err.message || err, {
icon: "error"
});
});
}, },
signInWithGithub() { signInWithGithub() {
const provider = new firebase.auth.GithubAuthProvider(); const provider = new firebase.auth.GithubAuthProvider();
firebase firebase
.auth() .auth()
.signInWithPopup(provider) .signInWithPopup(provider)
.catch(err => alert(err.message || err)); .catch(err => {
this.$toast.show(err.message || err, {
icon: "error"
});
});
} }
} }
}; };

View File

@@ -52,12 +52,10 @@ ballsCollection
ball.id = doc.id; ball.id = doc.id;
balls.push(ball); balls.push(ball);
}); });
console.log("Received Balls feed:", balls);
store.ballsInFeed = balls; store.ballsInFeed = balls;
}); });
// When a user logs in or out, save that in the store // When a user logs in or out, save that in the store
firebase.auth().onAuthStateChanged(user => { firebase.auth().onAuthStateChanged(user => {
console.log("Logged in as:", user);
store.currentUser = user; store.currentUser = user;
}); });

View File

@@ -249,5 +249,8 @@ export default {
extensions: "Extensions", extensions: "Extensions",
extensions_info1: "Browser extension that simplifies access to Postwoman", extensions_info1: "Browser extension that simplifies access to Postwoman",
extensions_info2: "Get Postwoman browser extension!", extensions_info2: "Get Postwoman browser extension!",
installed: "Installed" installed: "Installed",
login_with: "Login with",
logged_out: "Logged out",
logout: "Logout"
}; };

View File

@@ -288,6 +288,12 @@
> >
<i class="material-icons">offline_bolt</i> <i class="material-icons">offline_bolt</i>
</button> </button>
<login v-if="!store.currentUser" />
<span v-if="store.currentUser">
<button class="icon" @click="logout" v-tooltip="$t('logout')">
<i class="material-icons">exit_to_app</i>
</button>
</span>
<v-popover> <v-popover>
<button class="icon" v-tooltip="$t('more')"> <button class="icon" v-tooltip="$t('more')">
<i class="material-icons">more_vert</i> <i class="material-icons">more_vert</i>
@@ -345,13 +351,6 @@
</template> </template>
</v-popover> </v-popover>
</span> </span>
<login v-if="!store.currentUser" />
<div v-else>
<button @click="logout">Log out</button>
<inputform />
<ballsfeed />
</div>
</div> </div>
</header> </header>
<nuxt /> <nuxt />
@@ -607,9 +606,7 @@ export default {
components: { components: {
logo: () => import("../components/logo"), logo: () => import("../components/logo"),
modal: () => import("../components/modal"), modal: () => import("../components/modal"),
login: () => import("../components/firebase/login"), login: () => import("../components/firebase/login")
inputform: () => import("../components/firebase/inputform"),
ballsfeed: () => import("../components/firebase/feeds")
}, },
methods: { methods: {
@@ -624,7 +621,14 @@ export default {
firebase firebase
.auth() .auth()
.signOut() .signOut()
.catch(err => alert(err.message || err)); .catch(err => {
this.$toast.show(err.message || err, {
icon: "error"
});
});
this.$toast.info(this.$t("logged_out"), {
icon: "vpn_key"
});
} }
}, },
@@ -640,7 +644,6 @@ export default {
showSupport: false, showSupport: false,
firefoxExtInstalled: window.firefoxExtSendRequest, firefoxExtInstalled: window.firefoxExtSendRequest,
chromeExtInstalled: false, chromeExtInstalled: false,
store store
}; };
}, },

View File

@@ -846,6 +846,14 @@
<collections /> <collections />
</pw-section> </pw-section>
</div> </div>
<span v-if="store.currentUser">
<input id="auth-tab" type="radio" name="side" />
<label for="auth-tab">{{ $t("history") }}</label>
<div class="tab">
<inputform />
<ballsfeed />
</div>
</span>
</section> </section>
</aside> </aside>
@@ -1136,6 +1144,7 @@ import parseTemplateString from "../functions/templating";
import AceEditor from "../components/ace-editor"; import AceEditor from "../components/ace-editor";
import { tokenRequest, oauthRedirect } from "../assets/js/oauth"; import { tokenRequest, oauthRedirect } from "../assets/js/oauth";
import { sendNetworkRequest } from "../functions/network"; import { sendNetworkRequest } from "../functions/network";
import { store } from "../functions/store";
const statusCategories = [ const statusCategories = [
{ {
@@ -1200,7 +1209,9 @@ export default {
autocomplete: () => import("../components/autocomplete"), autocomplete: () => import("../components/autocomplete"),
collections: () => import("../components/collections"), collections: () => import("../components/collections"),
saveRequestAs: () => import("../components/collections/saveRequestAs"), saveRequestAs: () => import("../components/collections/saveRequestAs"),
Editor: AceEditor Editor: AceEditor,
inputform: () => import("../components/firebase/inputform"),
ballsfeed: () => import("../components/firebase/feeds")
}, },
data() { data() {
return { return {
@@ -1370,12 +1381,12 @@ export default {
], ],
showRequestModal: false, showRequestModal: false,
editRequest: {}, editRequest: {},
urlExcludes: {}, urlExcludes: {},
responseBodyText: "", responseBodyText: "",
responseBodyType: "text", responseBodyType: "text",
responseBodyMaxLines: 16, responseBodyMaxLines: 16,
activeSidebar: true activeSidebar: true,
store
}; };
}, },
watch: { watch: {