Skip to content

Commit

Permalink
chore: move all type to common file #10
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab committed Apr 18, 2024
1 parent fd8bb21 commit d2a2944
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
3 changes: 1 addition & 2 deletions app.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import type { User } from '~/libs/apiTypes'
import type { Project } from '~/libs/types'
import type { Project, User } from '~/libs/types'
const authToken = useCookie('_interslice_session')
if (authToken.value) {
Expand Down
2 changes: 1 addition & 1 deletion components/AppMenu.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { User } from '~/libs/apiTypes'
import type { User } from '~/libs/types'
const back = ref(true)
const user = useState<User>('user')
Expand Down
3 changes: 1 addition & 2 deletions components/Logs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import type { PropType } from 'vue'
import _ from 'underscore'
import type { Geometry } from 'geojson'
import type { User } from '~/libs/apiTypes'
import LogsComponent from '~/components/LogsComponent.vue'
import type { Log, ObjectId } from '~/libs/types'
import type { Log, ObjectId, User } from '~/libs/types'
import { setLogs } from '~/libs/types'
export default defineNuxtComponent({
Expand Down
2 changes: 1 addition & 1 deletion components/User.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { PropType } from 'vue'
import type { User } from '~/libs/apiTypes'
import type { User } from '~/libs/types'
import { userLogout } from '~/libs/apiTypes'
export default defineNuxtComponent({
Expand Down
7 changes: 0 additions & 7 deletions libs/apiTypes.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
export interface User {
osm_uid: number
osm_name: string
osm_image_url: string
projects: string[]
}

export function userLogout(apiEndpoint: string): Promise<void> {
return fetch(`${apiEndpoint}/../../../users`, {
method: 'DELETE',
Expand Down
7 changes: 7 additions & 0 deletions libs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ export interface ObjectId {
deleted: boolean
}

export interface User {
osm_uid: number
osm_name: string
osm_image_url: string
projects: string[]
}

export function getLogs(apiEndpoint: string, project: string): Promise<Log[]> {
return fetch(`${apiEndpoint}/projects/${project}/changes_logs/`).then(
(data) => {
Expand Down
3 changes: 1 addition & 2 deletions pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import _ from 'underscore'
import type { User } from '~/libs/apiTypes'
import type { Project } from '~/libs/types'
import type { Project, User } from '~/libs/types'
const user = useState<User>('user')
const projects = useState<Project>('projects')
Expand Down

0 comments on commit d2a2944

Please sign in to comment.