Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
AURA
dashboard
Commits
c8ed1d95
Commit
c8ed1d95
authored
1 year ago
by
Konrad Mohrfeldt
Browse files
Options
Downloads
Patches
Plain Diff
feat: add Pinia note store
refs
#127
parent
ecd9efb3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/stores/notes.ts
+65
-0
65 additions, 0 deletions
src/stores/notes.ts
with
65 additions
and
0 deletions
src/stores/notes.ts
0 → 100644
+
65
−
0
View file @
c8ed1d95
import
{
defineStore
}
from
'
pinia
'
import
{
steeringAuthInit
}
from
'
@/stores/auth
'
import
{
APICreate
,
APIListPaginated
,
APIRemove
,
APIRetrieve
,
APIUpdate
,
createExtendableAPI
,
createSteeringURL
,
}
from
'
@/api
'
export
type
Note
=
{
id
:
number
title
:
string
slug
:
string
summary
:
string
content
:
string
image
:
number
|
null
cba_id
:
number
|
null
contributors
:
number
[]
links
:
{
type
:
string
;
url
:
string
}[]
owner
:
number
playlist
:
string
tags
:
string
timeslot
:
number
created_at
:
string
created_by
:
string
updated_at
:
string
updated_by
:
string
}
type
ReadonlyAttrs
=
'
id
'
|
'
created_at
'
|
'
created_by
'
|
'
updated_at
'
|
'
updated_by
'
|
'
owner
'
export
type
NewNote
=
Omit
<
Note
,
ReadonlyAttrs
>
type
NoteCreateData
=
Omit
<
Note
,
ReadonlyAttrs
>
type
NoteUpdateData
=
Partial
<
Omit
<
Note
,
ReadonlyAttrs
>>
export
function
newNote
(
timeslotID
:
number
):
NewNote
{
return
{
title
:
''
,
slug
:
''
,
summary
:
''
,
content
:
''
,
image
:
null
,
cba_id
:
null
,
contributors
:
[],
links
:
[],
timeslot
:
timeslotID
,
tags
:
''
,
playlist
:
''
,
}
}
export
const
useNoteStore
=
defineStore
(
'
notes
'
,
()
=>
{
const
endpoint
=
createSteeringURL
.
prefix
(
'
notes
'
)
const
{
base
,
...
api
}
=
createExtendableAPI
<
Note
>
(
endpoint
,
steeringAuthInit
)
return
{
...
base
,
...
APIListPaginated
(
api
),
...
APIRetrieve
(
api
),
...
APICreate
<
Note
,
NoteCreateData
>
(
api
),
...
APIUpdate
<
Note
,
NoteUpdateData
>
(
api
),
...
APIRemove
(
api
),
}
})
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