Skip to content

Commit

Permalink
little better
Browse files Browse the repository at this point in the history
  • Loading branch information
mo9a7i committed Oct 3, 2022
1 parent beea475 commit c7caef1
Show file tree
Hide file tree
Showing 13 changed files with 233 additions and 200 deletions.
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"singleAttributePerLine": false,
Expand Down
16 changes: 10 additions & 6 deletions api/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ router.get('/authorize' ,(req, res) => {

router.get('/users/self' ,async (req, res) => {
try {
const auth_token = req.headers?.authorization?.split(' ')[1];
var response = await axios.get('https://api.foursquare.com/v2/users/self',{ params: {
oauth_token: auth_token,
v: '20220901'
}})
await res.json(response.data?.response?.user)
//console.log(req.headers.authorization);
const auth_token = req.headers?.authorization;
//console.log('here')
var response = await axios.get('https://api.foursquare.com/v2/users/self',{
params: {
oauth_token: auth_token,
v: '20220901'
}})

await res.json(response.data?.response)
}
catch (error) {
console.log(error)
Expand Down
90 changes: 88 additions & 2 deletions assets/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,96 @@
@import '_fonts.scss';
*/

@import '~bootstrap/scss/bootstrap'; /* these are the important lines for this task */
@import "~bootstrap/scss/bootstrap"; /* these are the important lines for this task */
@import "bootstrap-icons/font/bootstrap-icons.css"; /* these are the important lines for this task */

/* if you want to override
@import '_mixins.scss';
@import '_variables.scss';
*/
*/

.swarm-img {
aspect-ratio: 1/1;
height: 34px;
display: inline-block;
background: white;
-webkit-mask: url("@/assets/images/swarm.png") center/contain;
mask: url("@/assets/images/swarm.png") center/contain;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
}

body {
background-color: #f5f5f5;
}

.form-signin {
max-width: 330px;
padding: 15px;

.form-floating:focus-within {
z-index: 2;
}

input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}

input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
}

.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}

@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}

.b-example-divider {
height: 3rem;
background-color: rgba(0, 0, 0, 0.1);
border: solid rgba(0, 0, 0, 0.15);
border-width: 1px 0;
box-shadow: inset 0 0.5em 1.5em rgba(0, 0, 0, 0.1), inset 0 0.125em 0.5em rgba(0, 0, 0, 0.15);
}

.b-example-vr {
flex-shrink: 0;
width: 1.5rem;
height: 100vh;
}

.bi {
vertical-align: -0.125em;
fill: currentColor;
}

.nav-scroller {
position: relative;
z-index: 2;
height: 2.75rem;
overflow-y: hidden;
.nav {
display: flex;
flex-wrap: nowrap;
padding-bottom: 1rem;
margin-top: -1px;
overflow-x: auto;
text-align: center;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
}
79 changes: 28 additions & 51 deletions components/Home.vue
Original file line number Diff line number Diff line change
@@ -1,60 +1,37 @@
<!-- Please remove this file from your project -->
<template>
<section class="p-5 bg-alert">
<div class="container">
<div class="row">
<div class="col">
<div class="">
<h1>Welcome {{ this.$auth.user.firstName }}</h1>
<pre dir="ltr">
{{ this.$auth.user }}
</pre>



</div>
</div>
</div>
</div>
</section>

<section class="p-5 bg-alert">
<div class="container">
<div class="row">
<div class="col">
<div class="">
<h1>Welcome {{ this.$auth.user.user.firstName }}</h1>
</div>
</div>
</div>
</div>
</section>
</template>

<script>
export default {
mounted() {
console.log("mounted");
this.saveUser();
},
methods: {
async saveUser() {
//console.log(this.$auth.strategy.token.get());
//console.log(this.$auth.user)
//return;
//console.log(await this.$fire.firestore.collection('users').get());
const saveUser = await this.$myUtils.createUserInFirebase();

mounted(){
console.log('mounted')
this.saveUser();
},
methods: {
async saveUser() {
let token = this.$auth.strategy.token.get().replace('Bearer ','')
console.log('token',token)
console.log(await this.$fire.firestore.collection('users').get());
const messageRef = this.$fire.firestore.collection('users').doc(this.$auth.user.id)
try {
await messageRef.set({
user: this.$auth.user,
token: token,
date: new Date(Date.now())
})
} catch (e) {
console.log(e)
return
}
try {
await this.$fire.firestore.collection('users').add({
email: '[email protected]',
field: 'test'
}

)
} catch (e) {
console.log(e)
}
}
}

// get user configs
const userConfigs = await this.$myUtils.getConfigsFromFirebase();
console.log(userConfigs)

},
},
};
</script>
9 changes: 3 additions & 6 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ export default {
],

plugins: [
{
src: '~/plugins/bootstrap.client.js'
},
{src: '~/plugins/bootstrap.client.js'},
{src: '~/plugins/utils.js'},
],

components: true,
Expand Down Expand Up @@ -83,16 +82,14 @@ export default {
scheme: "oauth2",
responseType: 'code',
clientId: 'OUYWUC4AHY4VSFCWA0EB055U3V4A01WYGRSAZ0MXLS0JKCUA',
clientSecret: 'DK3KXOIRRPM3CGGXUYHEDTPVJDDNPDGDE0GYHUBWRCPNQLAG',
redirectUri: 'http://localhost:3000/login',
codeChallengeMethod: '',
accessType: 'offline',
token: {
property: 'access_token',
type: 'Bearer',
type: '',
maxAge: 1800,
},

endpoints: {
authorization: "https://foursquare.com/oauth2/authenticate",
token: "http://localhost:3000/api/swarm/access_token",
Expand Down
53 changes: 35 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
"@nuxtjs/proxy": "^2.1.0",
"@popperjs/core": "^2.11.5",
"body-parser": "^1.20.0",
"bootstrap": "^5.1.3",
"bootstrap": "^5.2.2",
"bootstrap-icons": "^1.8.1",
"bootstrap-sass": "^3.4.3",
"connect-timeout": "^1.9.0",
"cookie": "^0.5.0",
"core-js": "^3.19.3",
Expand Down
4 changes: 3 additions & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

<script>
export default {
name: 'IndexPage'
name: 'IndexPage',
auth: 'guest'
}
</script>
Loading

0 comments on commit c7caef1

Please sign in to comment.