Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boco-frontend
Manage
Activity
Members
Labels
Plan
Issues
21
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106_2022_02
boco-frontend
Commits
3d1b0de3
Commit
3d1b0de3
authored
2 years ago
by
Titus Netland
Browse files
Options
Downloads
Plain Diff
Merge branch 'create-group-connect-api' into 'main'
create-group-api See merge request
!39
parents
18fcb49b
7d3da695
No related branches found
No related tags found
1 merge request
!39
create-group-api
Pipeline
#176958
passed with stages
in 59 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/CreateNewGroup.vue
+62
-1
62 additions, 1 deletion
src/components/CreateNewGroup.vue
src/utils/apiutil.js
+16
-2
16 additions, 2 deletions
src/utils/apiutil.js
src/utils/token-utils.js
+1
-1
1 addition, 1 deletion
src/utils/token-utils.js
with
79 additions
and
4 deletions
src/components/CreateNewGroup.vue
+
62
−
1
View file @
3d1b0de3
...
@@ -76,6 +76,31 @@
...
@@ -76,6 +76,31 @@
</div>
</div>
</div>
</div>
<!-- Place -->
<div
class=
"mt-6"
:class=
"
{ error: v$.group.place.$errors.length }">
<label
class=
"block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
>
By/Sted
</label
>
<input
type=
"text"
class=
"bg-gray-200 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
v-model=
"v$.group.place.$model"
required
/>
<!-- error message for place-->
<div
class=
"text-red"
v-for=
"(error, index) of v$.group.place.$errors"
:key=
"index"
>
<div
class=
"text-red-600 text-sm"
>
{{
error
.
$message
}}
</div>
</div>
</div>
<!-- Select category -->
<!-- Select category -->
<div
class=
"mt-6"
>
<div
class=
"mt-6"
>
<label
<label
...
@@ -199,6 +224,7 @@
...
@@ -199,6 +224,7 @@
<
script
>
<
script
>
import
useVuelidate
from
"
@vuelidate/core
"
;
import
useVuelidate
from
"
@vuelidate/core
"
;
import
{
required
,
helpers
,
maxLength
}
from
"
@vuelidate/validators
"
;
import
{
required
,
helpers
,
maxLength
}
from
"
@vuelidate/validators
"
;
import
{
postNewgroup
}
from
"
@/utils/apiutil
"
;
export
default
{
export
default
{
name
:
"
CreateNewGroup.vue
"
,
name
:
"
CreateNewGroup.vue
"
,
...
@@ -220,6 +246,16 @@ export default {
...
@@ -220,6 +246,16 @@ export default {
maxLength
(
50
)
maxLength
(
50
)
),
),
},
},
place
:
{
required
:
helpers
.
withMessage
(
()
=>
"
Stedsnavn kan ikke være tom
"
,
required
),
max
:
helpers
.
withMessage
(
()
=>
`Stednavn kan være på max 50 tegn`
,
maxLength
(
50
)
),
},
description
:
{
description
:
{
required
:
helpers
.
withMessage
(
required
:
helpers
.
withMessage
(
()
=>
"
Beskrivelsen kan ikke være tom
"
,
()
=>
"
Beskrivelsen kan ikke være tom
"
,
...
@@ -245,6 +281,8 @@ export default {
...
@@ -245,6 +281,8 @@ export default {
images
:
[],
images
:
[],
categories
:
[
"
Borettslag
"
,
"
Idrettsklubb
"
,
"
Fritidsklubb
"
],
categories
:
[
"
Borettslag
"
,
"
Idrettsklubb
"
,
"
Fritidsklubb
"
],
radio
:
null
,
radio
:
null
,
place
:
""
,
visibility
:
1
,
},
},
imageThere
:
false
,
imageThere
:
false
,
};
};
...
@@ -267,6 +305,14 @@ export default {
...
@@ -267,6 +305,14 @@ export default {
checkRadioButton
:
function
(
event
)
{
checkRadioButton
:
function
(
event
)
{
this
.
group
.
radio
=
event
.
target
.
value
;
this
.
group
.
radio
=
event
.
target
.
value
;
console
.
log
(
this
.
group
.
radio
);
console
.
log
(
this
.
group
.
radio
);
if
(
this
.
group
.
radio
==
null
||
this
.
group
.
radio
==
"
Åpen
"
)
{
this
.
group
.
visibility
=
1
;
}
else
{
this
.
group
.
visibility
=
0
;
}
console
.
log
(
"
visibility:
"
+
this
.
group
.
visibility
);
},
},
checkValidation
:
function
()
{
checkValidation
:
function
()
{
console
.
log
(
"
sjekker validering
"
);
console
.
log
(
"
sjekker validering
"
);
...
@@ -287,11 +333,26 @@ export default {
...
@@ -287,11 +333,26 @@ export default {
if
(
this
.
checkValidation
())
{
if
(
this
.
checkValidation
())
{
console
.
log
(
"
validert, videre...
"
);
console
.
log
(
"
validert, videre...
"
);
console
.
log
(
"
Navn:
"
+
this
.
group
.
name
);
console
.
log
(
"
Navn:
"
+
this
.
group
.
name
);
console
.
log
(
"
Sted:
"
+
this
.
group
.
place
);
console
.
log
(
"
Synlighet:
"
+
this
.
group
.
radio
);
console
.
log
(
"
Synlighet:
"
+
this
.
group
.
radio
);
console
.
log
(
"
Kategori:
"
+
this
.
group
.
select
);
console
.
log
(
"
Kategori:
"
+
this
.
group
.
select
);
console
.
log
(
"
Beskrivelse:
"
+
this
.
group
.
description
);
console
.
log
(
"
Beskrivelse:
"
+
this
.
group
.
description
);
console
.
log
(
"
bilder:
"
+
this
.
group
.
images
);
console
.
log
(
"
bilder:
"
+
this
.
group
.
images
);
const
groupInfo
=
{
name
:
this
.
group
.
name
,
description
:
this
.
group
.
description
,
visibility
:
this
.
group
.
visibility
,
location
:
this
.
group
.
place
,
picture
:
""
,
};
console
.
log
(
groupInfo
);
const
postCreatedGroup
=
await
postNewgroup
(
groupInfo
);
console
.
log
(
postCreatedGroup
);
}
}
},
},
addImage
:
function
(
event
)
{
addImage
:
function
(
event
)
{
...
@@ -301,6 +362,6 @@ export default {
...
@@ -301,6 +362,6 @@ export default {
this
.
imageThere
=
true
;
this
.
imageThere
=
true
;
console
.
log
(
"
image:
"
+
this
.
imageThere
);
console
.
log
(
"
image:
"
+
this
.
imageThere
);
},
},
}
,
}
};
};
</
script
>
</
script
>
This diff is collapsed.
Click to expand it.
src/utils/apiutil.js
+
16
−
2
View file @
3d1b0de3
...
@@ -97,9 +97,23 @@ export function doNewPassword() {
...
@@ -97,9 +97,23 @@ export function doNewPassword() {
export
function
postNewItem
(
itemInfo
)
{
export
function
postNewItem
(
itemInfo
)
{
return
axios
return
axios
.
post
(
API_URL
+
"
listing
"
,
itemInfo
)
.
post
(
API_URL
+
"
listing
"
,
itemInfo
,
{
headers
:
tokenHeader
(),
})
.
then
((
response
)
=>
{
console
.
log
(
"
poster:
"
+
response
.
data
);
return
response
;
})
.
catch
((
error
)
=>
{
console
.
log
(
error
.
response
);
return
error
;
});
}
export
function
postNewgroup
(
groupInfo
)
{
return
axios
.
post
(
API_URL
+
"
communities/create
"
,
groupInfo
,
{
headers
:
tokenHeader
()
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
console
.
log
(
"
prøver:
"
+
response
.
data
);
return
response
;
return
response
;
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/utils/token-utils.js
+
1
−
1
View file @
3d1b0de3
...
@@ -3,7 +3,7 @@ import store from "@/store";
...
@@ -3,7 +3,7 @@ import store from "@/store";
export
function
tokenHeader
()
{
export
function
tokenHeader
()
{
let
token
=
store
.
state
.
user
.
token
;
let
token
=
store
.
state
.
user
.
token
;
return
{
Authorization
:
token
};
return
{
Authorization
:
"
Bearer
"
+
token
};
}
}
export
function
parseCurrentUser
()
{
export
function
parseCurrentUser
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment