Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb14a0e6

Browse files
author
Filip Hric
committed
add authorization to boards
1 parentc3cb471 commitb14a0e6

File tree

3 files changed

+33
-32
lines changed

3 files changed

+33
-32
lines changed

‎backend/api/board-routes.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,29 @@ app.get('/', ({ app: { parent: { db } }, headers, query }, res) => {
3030

3131
})
3232

33+
app.get('/:id',({app:{parent:{ db}}, params, headers},res,next)=>{
34+
35+
constboardId=parseInt(params.id)
36+
constboard=db
37+
.get('boards')
38+
.find({id:boardId})
39+
.value();
40+
41+
constuserId=getUserId(headers)||0;
42+
43+
if(board.user===userId||board.user===0){
44+
45+
next()
46+
47+
}
48+
else{
49+
res.status(403).jsonp({
50+
error:'You don’t have access to this board'
51+
});
52+
}
53+
54+
})
55+
3356
app.post('/',({ headers, body},res,next)=>{
3457

3558
validate(['name'],body,res)

‎backend/data/database.json‎

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,6 @@
11
{
2-
"boards": [
3-
{
4-
"name":"asdadfs",
5-
"user":0,
6-
"starred":false,
7-
"created":"2022-09-21",
8-
"id":1
9-
},
10-
{
11-
"name":"private",
12-
"user":1,
13-
"starred":false,
14-
"created":"2022-09-21",
15-
"id":2
16-
}
17-
],
2+
"boards": [],
183
"cards": [],
194
"lists": [],
20-
"users": [
21-
{
22-
"email":"filip@filiphric.sk",
23-
"password":"$2a$10$za8jyFVmMBiB.JzO8uYAfefc0yBBRXteb2Xh0XkOQPj4L2O2FQQfC",
24-
"welcomeEmail":false,
25-
"id":1
26-
}
27-
]
5+
"users": []
286
}

‎src/components/Pricing.vue‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,30 @@
7070
</template>
7171
<script setup lang="ts">
7272
import {useStore }from'@/store/store';
73-
import {ref }from'vue'
73+
import {ref }from'vue';
7474
import {storeToRefs }from'pinia';
7575
importemojifrom'node-emoji';
76-
import*asLfrom'leaflet'
76+
import*asLfrom'leaflet';
7777
importRoundCheckboxfrom'@/assets/icons/roundCheckbox.svg';
7878
const { pricing }=storeToRefs(useStore());
7979
const { getLocation }=useStore();
8080
getLocation();
8181
8282
const geolocation= ()=> {
8383
if (navigator.geolocation) {
84-
navigator.geolocation.getCurrentPosition(drawMap);
84+
navigator.geolocation.getCurrentPosition(drawMap);
8585
}
86-
else {
87-
console.log('not working!!')
86+
else {
87+
console.log('not working!!');
8888
}
89-
}
89+
};
9090
9191
const drawMap= (position:GeolocationPosition)=> {
9292
let map=L.map(ref('map').value);
9393
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addTo(map);
9494
let target=L.latLng(position.coords.latitude,position.coords.longitude);
9595
map.setView(target,14);
96-
}
96+
};
9797
9898
const plans: { [key:string]:any }= [
9999
{
@@ -124,4 +124,4 @@ const plans: { [key: string]: any } = [
124124
},
125125
},
126126
];
127-
</script>
127+
</script>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp