fix: 🐛 Fixes inheritance from @skolplattformen-api
This commit is contained in:
parent
a762d2dd8f
commit
ba45cfd796
|
@ -83,7 +83,6 @@ Check out the documentation [here](libs/hooks).
|
|||
To clone and build the project, you first need to install the required dependencies:
|
||||
```bash
|
||||
$ sudo apt install git npm
|
||||
$ npx lerna bootstrap
|
||||
```
|
||||
|
||||
Clone the repo with
|
||||
|
|
|
@ -5,7 +5,7 @@ import init from '@skolplattformen/api-hjarntorget'
|
|||
import { ApiProvider } from '@skolplattformen/hooks'
|
||||
import { ApplicationProvider, IconRegistry } from '@ui-kitten/components'
|
||||
import { EvaIconsPack } from '@ui-kitten/eva-icons'
|
||||
import React from 'react'
|
||||
import React, { useState } from 'react'
|
||||
import { StatusBar, useColorScheme } from 'react-native'
|
||||
import { SafeAreaProvider } from 'react-native-safe-area-context'
|
||||
import { AppNavigator } from './components/navigation.component'
|
||||
|
|
|
@ -47,7 +47,8 @@ export const Login = () => {
|
|||
>(() => () => null)
|
||||
const [visible, showModal] = useState(false)
|
||||
const [showLoginMethod, setShowLoginMethod] = useState(false)
|
||||
const [showSchoolPlatformPicker, setShowSchoolPlatformPicker] = useState(false)
|
||||
const [showSchoolPlatformPicker, setShowSchoolPlatformPicker] =
|
||||
useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [personalIdNumber, setPersonalIdNumber] = useSettingsStorage(
|
||||
'cachedPersonalIdentityNumber'
|
||||
|
@ -55,8 +56,9 @@ export const Login = () => {
|
|||
const [loginMethodIndex, setLoginMethodIndex] =
|
||||
useSettingsStorage('loginMethodIndex')
|
||||
|
||||
const [schoolPlatform, setSchoolPlatform] =
|
||||
useSettingsStorage('currentSchoolPlatform')
|
||||
const [schoolPlatform, setSchoolPlatform] = useSettingsStorage(
|
||||
'currentSchoolPlatform'
|
||||
)
|
||||
|
||||
const { t } = useTranslation()
|
||||
|
||||
|
@ -71,12 +73,12 @@ export const Login = () => {
|
|||
const schoolPlatforms = [
|
||||
{
|
||||
id: 'stockholm-skolplattformen',
|
||||
displayName: 'Stockholm stad'
|
||||
displayName: 'Stockholm stad',
|
||||
},
|
||||
{
|
||||
id: 'goteborg-hjarnkontoret',
|
||||
displayName: 'Göteborg stad'
|
||||
}
|
||||
displayName: 'Göteborg stad',
|
||||
},
|
||||
]
|
||||
|
||||
const loginHandler = async () => {
|
||||
|
@ -96,7 +98,8 @@ export const Login = () => {
|
|||
}
|
||||
|
||||
const getSchoolPlatformName = () => {
|
||||
return schoolPlatforms.find(item => item.id === schoolPlatform)?.displayName;
|
||||
return schoolPlatforms.find((item) => item.id === schoolPlatform)
|
||||
?.displayName
|
||||
}
|
||||
|
||||
const openBankId = (token: string) => {
|
||||
|
@ -207,13 +210,14 @@ export const Login = () => {
|
|||
</ButtonGroup>
|
||||
<View style={styles.platformPicker}>
|
||||
<Button
|
||||
appearance='ghost'
|
||||
status='basic'
|
||||
size="small"
|
||||
accessoryRight={SelectIcon}
|
||||
onPress={() => {
|
||||
setShowSchoolPlatformPicker(true)
|
||||
}}>
|
||||
appearance="ghost"
|
||||
status="basic"
|
||||
size="small"
|
||||
accessoryRight={SelectIcon}
|
||||
onPress={() => {
|
||||
setShowSchoolPlatformPicker(true)
|
||||
}}
|
||||
>
|
||||
{getSchoolPlatformName()}
|
||||
</Button>
|
||||
</View>
|
||||
|
@ -281,8 +285,9 @@ export const Login = () => {
|
|||
visible={showSchoolPlatformPicker}
|
||||
style={styles.modal}
|
||||
onBackdropPress={() => setShowSchoolPlatformPicker(false)}
|
||||
backdropStyle={styles.backdrop}>
|
||||
<Card>
|
||||
backdropStyle={styles.backdrop}
|
||||
>
|
||||
<Card>
|
||||
<List
|
||||
data={schoolPlatforms}
|
||||
ItemSeparatorComponent={Divider}
|
||||
|
@ -300,7 +305,7 @@ export const Login = () => {
|
|||
/>
|
||||
)}
|
||||
/>
|
||||
</Card>
|
||||
</Card>
|
||||
</Modal>
|
||||
</>
|
||||
)
|
||||
|
@ -331,5 +336,5 @@ const themedStyles = StyleService.create({
|
|||
},
|
||||
platformPicker: {
|
||||
width: '100%',
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
@ -6,7 +6,7 @@ import { Api, FetcherOptions, Fetch, RNCookieManager,
|
|||
|
||||
const init = (
|
||||
fetchImpl: Fetch,
|
||||
cookieManagerImpl: any,
|
||||
cookieManagerImpl: RNCookieManager | ToughCookieJar,
|
||||
options?: FetcherOptions
|
||||
): Api => {
|
||||
// prettier-ignore
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Language } from '@skolplattformen/curriculum'
|
||||
import { EventEmitter } from 'events'
|
||||
import { DateTime } from 'luxon'
|
||||
import { LoginStatusChecker } from './loginStatus'
|
||||
import {
|
||||
|
@ -14,8 +15,9 @@ import {
|
|||
ScheduleItem,
|
||||
} from './types'
|
||||
|
||||
export interface Api {
|
||||
isFake:boolean
|
||||
export interface Api extends EventEmitter {
|
||||
isFake: boolean
|
||||
isLoggedIn: boolean
|
||||
getPersonalNumber(): string | undefined
|
||||
login(personalNumber?: string): Promise<LoginStatusChecker>
|
||||
setSessionCookie(sessionCookie: string): Promise<void>
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
import {
|
||||
Child,
|
||||
EtjanstChild,
|
||||
Skola24Child,
|
||||
} from '@skolplattformen/api-skolplattformen'
|
||||
import { Child, EtjanstChild, Skola24Child } from '@skolplattformen/api'
|
||||
|
||||
export const merge = (
|
||||
etjanstChildren: EtjanstChild[],
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
Skola24Child,
|
||||
TimetableEntry,
|
||||
User,
|
||||
} from '@skolplattformen/api-skolplattformen'
|
||||
} from '@skolplattformen/api'
|
||||
import { Language } from '@skolplattformen/curriculum'
|
||||
import { DateTime } from 'luxon'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable default-case */
|
||||
import { Middleware } from 'redux'
|
||||
import { EntityAction, EntityStoreRootState, ExtraActionProps } from './types'
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
/* eslint-disable react/prop-types */
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { Api } from '@skolplattformen/api-skolplattformen'
|
||||
import { Api } from '@skolplattformen/api'
|
||||
import React, { FC, PropsWithChildren, useEffect, useState } from 'react'
|
||||
import { Provider } from 'react-redux'
|
||||
import { ApiContext } from './context'
|
||||
|
@ -56,6 +54,7 @@ export const ApiProvider: TApiProvider = ({
|
|||
api.off('login', handler)
|
||||
api.off('logout', handler)
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [api.isLoggedIn, api.isFake])
|
||||
|
||||
return (
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
Skola24Child,
|
||||
TimetableEntry,
|
||||
User,
|
||||
} from '@skolplattformen/api-skolplattformen'
|
||||
} from '@skolplattformen/api'
|
||||
import { EntityName, EntityReducer, EntityState } from './types'
|
||||
|
||||
const createReducer = <T>(entity: EntityName): EntityReducer<T> => {
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
Skola24Child,
|
||||
TimetableEntry,
|
||||
User,
|
||||
} from '@skolplattformen/api-skolplattformen'
|
||||
} from '@skolplattformen/api'
|
||||
import { Action, Reducer } from 'redux'
|
||||
|
||||
export interface Reporter {
|
||||
|
|
Loading…
Reference in New Issue